Konrad Reiche
Konrad Reiche

Reputation: 29493

Building shared library with Eclipse CDT directly

I would like to move the building of my C++ project completely to Eclipse CDT, however I am facing some configuration problems. Here is my old g++ compiler call:

g++ -I/home/lib/tinyxml
    -I/usr/lib/jvm/java-6-openjdk/include
    -L/usr/local/lib -L/home/konrad/tinyxml
    -lboost_system
    -lboost_thread
    -lboost_regex 
    -fPIC
    -shared
    -o libagent.so
    agent.cpp AgentSocket.cpp ThreadInfo.cpp  
    /home/lib/tinyxml/tinyxml.cpp
    /home/lib/tinyxml/tinyxmlerror.cpp 
    /home/lib/tinyxml/tinyxmlparser.cpp
    /home/lib/tinyxml/tinystr.cpp 

When creating the project I choose Shared Library > Emtpy Project

Here are my problems:

  1. The Eclipse CDT generates the makefile in a way, it first compiles every .cpp file and then recompile it to the shared library. This let's me face one or more issues. I would like to jump this step and run it in the same way I did in the console.

  2. I cannot configure -L and -l options into the C++ building configuration, as Eclipse CDT offers these option only for the C++ linking part, but not for the C++ compiler part, but I need them already there, as the project doesn't compile without errors.

Upvotes: 0

Views: 2681

Answers (1)

eriktous
eriktous

Reputation: 6649

  1. That's not a problem, but actually how makefiles usually are constructed. This way, if you change one source file, you don't have to recompile all other source files, but only the one that has changed. It minimizes recompilation time.
  2. That shouldn't be a problem, because they are options that are only used during linking. Compilation of source files into object files shouldn't depend on external libraries.

Upvotes: 1

Related Questions