I have a rather strange linking problem. I'm working on a project in C++ on Linux. The project is rather large, and its modules are broken into multiple subdirectories.
I've just written a new executable module called "bigbang", which links to a number of static libraries which are also part of the project. Three of the libraries are:
The source code of all three libraries reside in their own sub directories.
libconceptgraph.a only links to some system libraries. libconceptmatch.a links to some system libraries and libconceptgraph.a, and libcompactucgparser.a links to some system libraries and libconceptgraph.a and libconceptmatch.a.
I can compile the 3 static libraries without any problem.
However, when I link them together to compile the object file for the executable bigbang, I get linking errors saying that some of the functions used in libcompactucgparser.a are not defined.
I checked the compilation flags and all three libraries are linked to the object file of bigbang.
So, I really have no idea what's happening here. Would anyone be able to help?
And if you have circular dependencies, it is OK to link against the same library twice to resolve all symbols. It does not affect execution or size of the program.
So worst case scenario, just do
-lgraph -lmatch -lparser -lmatch -lparser
and that _will_ work, though I recommend only doing it if you indeed have circular dependencies (it sounds like you don't).