Undefine references to SQLite

Hi, after following the C++ Sqlite example from the community I find an error trying to compile the c++ lib. Any idea what might be happening? [cmake]: – Found the following Boost libraries:

[cmake]: – regex
[cmake]: – Configuring done
[cmake]: – Generating done
[cmake]: – Build files have been written to: C:/Users/ht3b3d/eclipse-workspace/FirstSQL/intermediate/cmake/AXCF2152,19.0.0.17548/Release
[cmake]: [ 12%] Building CXX object CMakeFiles/FirstSQL.dir/intermediate/code/FirstSQLLibrary.cpp.o
[cmake]: [ 25%] Building CXX object CMakeFiles/FirstSQL.dir/intermediate/code/FirstSQLLibrary.meta.cpp.o
[cmake]: [ 37%] Building CXX object CMakeFiles/FirstSQL.dir/intermediate/code/MyComponent.meta.cpp.o
[cmake]: [ 50%] Building CXX object CMakeFiles/FirstSQL.dir/intermediate/code/MyComponentProgramProvider.cpp.o
[cmake]: [ 62%] Building CXX object CMakeFiles/FirstSQL.dir/src/MyComponent.cpp.o
[cmake]: [ 75%] Building CXX object CMakeFiles/FirstSQL.dir/src/MyProgram.cpp.o
[cmake]: [ 87%] Linking CXX shared library libFirstSQL.so
[cmake]: CMakeFiles/FirstSQL.dir/src/MyComponent.cpp.o: In function FirstSQL::MyComponent::SetupConfig()': [cmake]: MyComponent.cpp:(.text+0x2a): undefined reference to sqlite3_open’
[cmake]: MyComponent.cpp:(.text+0x42): undefined reference to sqlite3_close' [cmake]: MyComponent.cpp:(.text+0x4e): undefined reference to sqlite3_errmsg’
[cmake]: collect2.exe: error: ld returned 1 exit status
[cmake]: make.exe[2]: *** [CMakeFiles/FirstSQL.dir/build.make:185: libFirstSQL.so] Error 1
[cmake]: make.exe[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/FirstSQL.dir/all] Error 2
[cmake]: make.exe: *** [Makefile:130: all] Error 2
cmake process exited with error Thanks, Angel

Hi Angel, The undefined references indicate that it’s not linking to the sqlite library. Are you sure that your CMake files look exactly like the code snippets in Step 2 of the example?

Thanks Martin, you were right. It fails a couple of script lines. At the moment I don´t understand the “magic” inside these script lines :slight_smile: Thanks!

OK, glad that it’s working. CMake is a large topic and takes a lot of time and effort to master (I am just a CMake beginner myself). Since CMake is used by the PLCnext CLI, you will need to know some CMake in order to modify your CLI projects, e.g. to include external libraries. Here is a starting point for teaching yourself Cmake: https://cliutils.gitlab.io/modern-cmake/chapters/basics.html If you have any questions about CMake, there is probably an answer on Stack Overflow or somewhere else on the web. Good luck! Martin.