3

I am using the managed make functionality of Eclipse CDT. Creating the project using dynamic only libraries is working as expected. But the boost_unit_test_framework should be linked statically, because it contains the main function. On the command line it is not a problem to link to dynamic and static libraries in a mixture. So this is a working example:

g++ -L../Debug -L../boost/lib -o "Test" ./Test.o -ldynLib -Wl,-Bstatic -lboost_unit_test_framework -Wl,-Bdynamic

The dynlib and the standard libraries like libc are linked dynamically and the boost_unit_test_framework is linked statically. BUT how can I enter this information in the Settings of the Project? I can not see any way.

It may be possible to flag this library in every project for static linking, for example in a global place. There is convention used by QNX ([manual]). It is possible to use LIBPREF_library and LIBPOST_library to add Options before or after the specified library.

Update: I have still no clue how to solve the described problem. But in the meantime I have switched my build system from Managed Make to CMake. And additionally I am now using the Qt Creator because it is able to index boost and does not freeze the UI while updating some internal structures ...

[manual] http://www.qnx.com/developers/docs/6.3.0SP3/neutrino/prog/make_convent.html#USEMAC

Christian
  • 1,017
  • 3
  • 14
  • 30

2 Answers2

2

Dynalic libraries goes in : Linker/Libraries/Libraries (-l) Static libraries goes in : Linker/miscelanous/Other files and objects

pierre
  • 21
  • 2
  • Thank you for your answer. But how does that hint help my problem? Can you provide some more information, please. TiA – Christian Feb 04 '14 at 12:15
2

I don't think you need to specify the type of linking. Dynamic libraries can't be linked statically, and vice versa. On one of my projects, under Project Properties -> C/C++ Build -> Settings, I have both static and dynamic libraries listed under Libraries. It seems to work out what type they are and link fine either way.

PherricOxide
  • 15,493
  • 3
  • 28
  • 41
  • The problem is that the mentioned library boost_unit_test_framework is available as dynamic **and** static library. I want to link dynamically except the boost_unit_test_framework. I have found no way to explicitly set the linking for a single library (within a managed make c++ project). – Christian Apr 02 '12 at 15:51