0

I have a C++ project I am importing and it is using activemq libraries. After I import the project, I set the LD_LIBRARY_PATH variable under environment to point to

/usr/local/include/activemq-cpp-3.4.2

This allows the project to see all the libraries for activemq and I can see it show up in my includdes folder in the project explorer. When I go to Build Project, I am getting tons of errors to references of includes/objects that are inside /usr/local/include/activemq-cpp-3.4.2. The interesting thing is that the binary is still being produced, yet there are about 80 errors due to the library files not being found. How is the binary being made? Also, what must I do to the LD_LIBRARY_PATH environment variable so the project is properly including those files?

I have tried launching eclipse with the

./eclipse -clean

But that didn't seem to help. Any ideas are welcome, and thank you in advance!

EDIT:

I am using Eclipse Juno with C++ verseion 4.1.2 on Redhat 4.X

user1314238
  • 389
  • 1
  • 3
  • 16

2 Answers2

2

LD_LIBRARY_PATH isn't used for locating include directories. It's used to inform the system of a list of directories to search for shared libraries: compiled support libraries, not e.g. SDKs for Eclipse.

You should use the project's properties to add to the places that are searched for includes: C++ General->Paths and Symbols->Includes

Also use the properties - not LD_LIBRARY_PATH - if you do need to link against other libraries: : C++ General->Paths and Symbols->Library Paths

pb2q
  • 58,613
  • 19
  • 146
  • 147
1

Finding header files is not the purpose of LD_LIBRARY_PATH. That environment variable is to tell the OS where to start looking for shared libraries — *.so files. The OS looks for those when preparing the execute your program. The compiler uses the include path to search for headers when it encounters an #include statement in your source code.

Don't modify LD_LIBRARY_PATH to affect compilation of your program.

Eclipse lets you set your include path in your project options.

Rob Kennedy
  • 161,384
  • 21
  • 275
  • 467
  • Isn't `#include` a preprocessor directive? The preprocessor is a program itself. It searches the source code for `#` commands and alters the code (adds needed code definitions) or performs "text substitution", then the compiler steps through the preprocessed source and looks for syntax errors, and if clean creates an object file. – ChiefTwoPencils Jul 23 '12 at 19:49
  • You can argue the distinction between compiler and preprocessor if you want, @Roberto, but the point remains that the locations searched for included files have nothing to do with LD_LIBRARY_PATH. – Rob Kennedy Jul 23 '12 at 19:54
  • Yes, my intent isn't to argue any point, step on toes, or even answer the question. More to make sure what I've learned is correct. Thanks, @Rob Kennedy! – ChiefTwoPencils Jul 23 '12 at 19:56