Quick question about library linking

General questions regarding the usage of CodeLite
amma
CodeLite Curious
Posts: 2
Joined: Fri Apr 23, 2010 5:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Quick question about library linking

Post by amma »

Hi,

I've never used an IDE before for C++. I'm relearning C++ and discovered the CodeLite IDE.
I've been quite content so far with the general feel and usage of the tool, but i have managed to somehow get stuck due to the following problem

assume i would build a file using the command (in console)

Code: Select all

g++ -o xxx -I/usr/include/t1 -I/usr/local/include/t2/  main.cpp
How can I get Codelite find and build the libraries i need.
I have tried adding the directories in the parser include files tab in the workspace settings but to no avail.

Any help is welcome

Using g++ on fedora 12 (64 bit) and using latest codelite build.
User avatar
eranif
CodeLite Plugin
Posts: 6372
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Quick question about library linking

Post by eranif »

Right click on the project and select 'settings', select the 'linker' tab.

To add libraries, add them as semi-colon linst of the library names only in the 'Libraries' field

To add search path for libraries, add them as semi-colon separated list in the 'Library Path' field.

Eran
Make sure you have read the HOW TO POST thread
amma
CodeLite Curious
Posts: 2
Joined: Fri Apr 23, 2010 5:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Same and new problem

Post by amma »

Hello again,

Thanks for the quick reply.
After spending sometime trying some possible combinations I'm still stuck trying to figure out the configuration.
To build I use this exact command which works:

Code: Select all

g++ -o x main.cpp -L/usr/lib64/mysql -lmysqlclient -I/usr/include/mysql
I believe this is what i have, which is obviously incorrect, the question remains how?
Options remains blank
Library path: /usr/include/mysql; /usr/lib64/mysql
Library:lmysqlclient

Also
Upon resuming work this morning, i've spend some time encountering the following message upon building the previous days work: Command Line empty and the system doing nothing. I've encountered this yesterday and managed to fix things rather soon. But today I just decided to reinstall which solved things instantaneously (I do realize this was rather harsh, but hey it got the job done). What is the appropriate course of action for this problem?

I apologize for the triviality of these questions as I really am somewhat oblivious to actual terminology and do thank you for finding time to answer and for authoring a fine product;)
User avatar
eranif
CodeLite Plugin
Posts: 6372
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Quick question about library linking

Post by eranif »

amma wrote:Library:lmysqlclient
The lib name is incorrect, when passed to the linker like this:

Code: Select all

-lmysqlclient
it means that the actual file on the disk should be:

either: libmysqlclient.a or libmysqlclient.so

so you should set one of those names in the 'Libraries' field in the project settings.
amma wrote:Command Line empty and the system doing nothing
This means that you created a custom build project, but did not set any command for the build.
'Custom build' project means a project that *you* the user is responsible for providing the makefile/build tool for building the project.
You can see if your project is a 'custom project' by opening the project settings and switch to the 'Custom Build' tab, if the 'Enable custom build' option is enabled, then this is a custom build project.
Eran
Make sure you have read the HOW TO POST thread
Post Reply