Having issues compiling C code (sqlite) libdl.so not linked
I have a project that includes sqlite3 code for basic db access.
all the rest compiles well, but sqlite3 code fails with the following:
CMakeFiles/tCPP.dir/src/sql3/sqlite3.c.o: In function `unixDlOpen':
/home/narunas/Development/todo/tCPP/src/sql3/sqlite3.c:28402: undefined reference to `dlopen'
CMakeFiles/tCPP.dir/src/sql3/sqlite3.c.o: In function `unixDlError':
/home/narunas/Development/todo/tCPP/src/sql3/sqlite3.c:28416: undefined reference to `dlerror'
CMakeFiles/tCPP.dir/src/sql3/sqlite3.c.o: In function `unixDlSym':
/home/narunas/Development/todo/tCPP/src/sql3/sqlite3.c:28442: undefined reference to `dlsym'
CMakeFiles/tCPP.dir/src/sql3/sqlite3.c.o: In function `unixDlClose':
/home/narunas/Development/todo/tCPP/src/sql3/sqlite3.c:28447: undefined reference to `dlclose'
my CMake includes the following paramaters:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -ldl -std=c++11 ")
it appears that the libdl.so is not linked or the flag "-ldl" is not passed
Could use some advice
Narunas
Please sign in to leave a comment.
just to simplify the above question:
including boilerplate start of new project code with a call to dlopen.
**main.cpp**
** CMakeList.txt **
in CMake tab > Cache I also added the -ldl flag to "CMAKE_C_FLAGS"
the above fails to compile as in the original question.
Hi Narunas!
Please try the following CMakeLists.txt, it works for me:
Thanks Anna - this appears to have solved the issue - the test program and the one that uses sqlite3 now compile!
Again, thanks!
Narunas