Page 1 of 1

Link library issue

Posted: Thu Jun 22, 2017 2:05 pm
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,

Re: Link library issue

Posted: Thu Jun 22, 2017 2:43 pm
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

Re: Link library issue

Posted: Fri Jun 23, 2017 11:15 am
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.