Compilter Linker flags?

CodeLite installation/troubleshooting forum
quantlabs
CodeLite Curious
Posts: 1
Joined: Thu Jun 09, 2016 6:10 am
Genuine User: Yes
IDE Question: c++
Contact:

Compilter Linker flags?

Post by quantlabs »

HI there
You have a really nice IDE. Thanks for creating. I am following the instruction to dynamically load classes into a C++ project.

http://stackoverflow.com/questions/4966 ... y-on-linux
Here are the g++ compiler commands:

Code: Select all

g++ -fPIC -shared myclass.cc -o myclass.so
g++ class_user.cc -ldl -o class_user 
Under the project setting, how I do I apply the separate g++ commands with each having their own set of compiler and linker flags? Is this possible to batch in Codelite?

Thanks
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Compilter Linker flags?

Post by eranif »

First get familiar with IDE by creating a simple "Hello World": http://codelite.org/LiteEditor/QuickStart
The Linker and Compiler options can be altered by right clicking on the project icon and select "settings" -> Compiler or Linker pages

About your specific issue:
* "-fPIC" is automatically set by CodeLite when creating a shared object - you don't need to add it by yourself, just ensure that you are creating a "Dynamic Library" project (in the above link, select the correct template)
"-ldl" is a library (libdl.so), you need to add it to the library list from: "project settings->linker->libraries" and set there: "dl" (without the "-l")

Eran
Make sure you have read the HOW TO POST thread
Post Reply