Hello, I’m a fairly new programmer (certainly very new to anything that requires multiple source files and headers across translation units) and I was trying to compile my project file but was met with a very difficult to understand error. For context, this is how my project is organized:
ProjectRoot
include (empty)
lib (empty)
src
commsDerived
commsDerived.hpp
commsDerived.cpp
actionsDerived
actionsDerived.hpp
actionsDerived.cpp
externalLibrary (my lib_extra_dirs = ${PROJECT_DIR}\..\externalLibrary)
library.json
commsBase
commsBase.hpp
commsBase.cpp
actionsBase
actionsBase.hpp
actionsBase.cpp
stuff in the external library of mine seems to compile fine, the archiving and indexing of the external library seems fine but the linker throws up a bunch of undefined reference errors to methods in the external library soon after, which according to Google is a result of being unable to find source files for definition of a declared method.
I am not sure if the error is related to my non-adherence to the recommended structure of putting headers in include, and my external library is going to be used by another project so ideally i’d want to not have different copies of the library in each project folder to make editing it more easier.
Is there problem to do with how I am organizing my source/header files under src? Or do I need to add stuff to my build flag in order to get the linker to see my external lib source files?