Configuring Default Libraries/Include Directives

CodeLite installation/troubleshooting forum
HJarausch
CodeLite Veteran
Posts: 98
Joined: Thu Feb 18, 2010 10:54 pm
Genuine User: Yes
IDE Question: C++
Contact:

Configuring Default Libraries/Include Directives

Post by HJarausch »

Hi,
I'd like to specify some libraries/include directives that should be included in every project.
(It's for a programming course for beginners in C++).
How can this be done.

(Codelite 2.2.0.3681 on GenToo Linux - built from source)
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Configuring Default Libraries/Include Directives

Post by eranif »

HJarausch wrote:I'd like to specify some libraries/include directives that should be included in every project.
You can only add a global include directives. This can be done from the menu: Settings > Build Settings > Compilers, Select your compiler, and then select the 'Advanced' page

Eran
Make sure you have read the HOW TO POST thread
HJarausch
CodeLite Veteran
Posts: 98
Joined: Thu Feb 18, 2010 10:54 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Configuring Default Libraries/Include Directives

Post by HJarausch »

Thanks!

I've tried to put

/usr/local/lib -lMatrix

into the Libraries Path: field.

Unfortunately this generates

"-L /usr/local/lib -lMatrix"

without the quotation marks this would be fine.
Is it difficult to change that.

I need several libraries to linked in and I don't want my students to type them all in.

Thanks for a hint,
Helmut.
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Configuring Default Libraries/Include Directives

Post by eranif »

The quotation marks are there for a reason: on windows there can be space in the paths.

Like I said: you can add path but not libraries.

Eran
Make sure you have read the HOW TO POST thread
HJarausch
CodeLite Veteran
Posts: 98
Joined: Thu Feb 18, 2010 10:54 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Configuring Default Libraries/Include Directives

Post by HJarausch »

I have 2 questions, though.
How set a path with more than 1 component?

With project-settings Linker
To specify more than one library does work but is tricky

One has to say

Lib1 -lLib2
since the '-l1' is preprended to the whole string.

Or did I miss something?
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Configuring Default Libraries/Include Directives

Post by eranif »

To add multiple libraries, simply add them as a semi-colon delimited list in the project settings -> Linker -> libraries:

Code: Select all

my_lib1;my_lib2;my_lib3
this will be converted into:

Code: Select all

-lmy_lib1 -lmy_lib2 -lmy_lib3
The same thing for adding search paths:

Code: Select all

/path/one;/path/two;...
Codelite will convert it to:

Code: Select all

-L"/path/one" -L"/path/two"
Eran
Make sure you have read the HOW TO POST thread
Post Reply