Link library issue

General questions regarding the usage of CodeLite
coot
CodeLite Enthusiast
Posts: 20
Joined: Thu Jun 15, 2017 1:41 pm
Genuine User: Yes
IDE Question: c++
Contact:

Link library issue

Post by coot »

I am trying to link a static library in the project.

In setting->compiler, set include paths as "test/include" (it works)
In setting->linker, set libraries search path as "test/lib"; and set libraries as "libtest.a" (the error: "ld.exe: cannot find -ltest")

finially, I use "absolute path+library name" in "libraries", then it works.

So, I am not sure what is the right way to use libraries search path and libraries?

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

Re: Link library issue

Post by eranif »

You can use full paths, it will work, however, sharing your project will be a bit more problematic.
Try using the macros provided by CodeLite to define where the library is located (click on the project settings "Help" button)
For example, if you placed your libraries under the workspace-folder/lib folder, you can use something like this:
$(WorkspacePath)/lib
Make sure you have read the HOW TO POST thread
coot
CodeLite Enthusiast
Posts: 20
Joined: Thu Jun 15, 2017 1:41 pm
Genuine User: Yes
IDE Question: c++
Contact:

Re: Link library issue

Post by coot »

as your suggested, I tried

Code: Select all

$(ProjectPath)/test_SDK/lib
in library search path, and the library name in libraries. It still does not work.

However, when I tried

Code: Select all

${PROJECT_test_SDK_PATH}/test_SDK/lib/test.dll.a
in libraries field, it works. ${PROJECT_test_SDK_PATH} is the value that $(ProjectPath) shown in cmake file, bucause $(ProjectPath) can not be used in libraries field.
Post Reply