1

I used to code using visual studio,when linking boost libraries I just added the folder having libraries e.g boost/lib and vs automatically choose the required lib files and link against them.

Now I am trying to link to boost lib in eclipse.I added the /usr/loca/lib folder which has boost library files.
But undefined reference error happens to all boost libraries.
I read that I must add each library file by its name in eclipse.
Is this the only way ?Is there automatic way to choose the required library files like visual studio?
thanks for your help.

ahmed allam
  • 377
  • 2
  • 15

1 Answers1

1

I assume by Eclipse you mean Eclipse with MinGW or Cygwin (both GCC-based toolchains).

Auto-linking (#pragma comment(lib ...)) is a Visual C++ feature that is not available in GCC.

With GCC you have to specify all the boost libraries that you're using when linking the program (including any libraries used by those libraries, like -lboost_system, etc.), in the right order.

rustyx
  • 80,671
  • 25
  • 200
  • 267