Reputation: 131258
In Eclipse I have created two libraries. One of them is shared another one is static. I have compiled them in Eclipse and as a result a Debug folder was created (for both libraries) and these folders contain make-files as well as object files (*.o) and dependency reference file (*.d). In addition to that, the static library contains an *.a file.
Now I create a new project and what to use these library in this project. Normally, when I use a library I type #include <libraryname>
. But if I use #include <mylibraryname>
it does not work (I get unresolved inclusion). And this is not surprising because Eclipse should somehow know where my library is located. So, my question is how can I inform Eclipse about the locations of my libraries.
ADDED As recommended I do the following sequence "Project -> Properties -> C/C++ Build -> Settings -> Tool Settings -> GCC C++ Linker -> Libraries". Then, in the "libraries(-l)" filed I add "StaticList" (because I have "libStaticList.a" file) and in the "Library search path (-L)" filed I give the full name of the directory where my "libStaticList.a" is located. Then I click Apply and OK. But it does not help. Eclipse does not like #include <StaticList>
. It complains: "Unresolved Inclusion..".
Upvotes: 2
Views: 1869
Reputation: 31
I think you need to #include "yourlibrary.cpp" (between double quotes) instead of < >.
Upvotes: 0
Reputation: 10507
#include
ing headers only makes the compiler aware that the functions in those headers exist. The actual implementation of those functions needs to be linked in by the linker. That's where the library (.a
) files that you built come in. Check out this thread for an example on how to link in your libraries using Eclipse.
Upvotes: 3