0
votes

I want to use the SQLAPI library, i have copied all files in the include directory to usr/local/include/SQLAPI and all files from the lib directory to usr/local/lib. The lib files are named libsqlapi.a /libsqlapi.so and libsqlapiu.a /libsqlapiu.so .

My cmakeLists.txt looks like this:

project(gsl_test)
cmake_minimum_required(VERSION 2.8)

SET(CMAKE_CXX_FLAGS "-std=c++0x")

aux_source_directory(. SRC_LIST)
include_directories(usr/local/include)
link_directories(usr/local/lib)

add_executable(${PROJECT_NAME} ${SRC_LIST})
target_link_libraries(${PROJECT_NAME} libsqlapi)

I get the build/linker error: cannot find -llibsqlapi.

I did also try target_link_libraries(${PROJECT_NAME} sqlapi), but it gives me additional "skipping incompatible //usr/local/lib/libsqlapi.so" (and the same for .a) with cannot find -lsqlapi

1
target_link_libraries(${PROJECT_NAME} sqlapi) ? You want to link -lsqlapi , not -llibsqlapi.pSoLT
@pSoLT I did try this before, but edited my post now, thanks.kassio

1 Answers

0
votes

Ok, i'll change my edit to an answer:

The reason linker complained was the fact that you specified the library in the wrong manner. lib is just prefix - if you use target_link_libraries you use the rest of library name. Changing to

target_link_libraries(${PROJECT_NAME} sqlapi)

solved that issue. The error you receive now

skipping incompatible //usr/local/lib/libsqlapi.so

Is most probably caused by the fact that you have copied all the files from some pre-build package and it's not compatible with your system. You need to recompile the library on your own.