Home > Blockchain >  How can I compile lsqlite3 for Windows?
How can I compile lsqlite3 for Windows?

Time:10-30

I have a C project developed in Ubuntu Linux. This C project is not written by me. Also, it runs under Ubuntu without any issues.

I am trying to compile the project under Windows 10 using GCC/G compiler and Visual Studio 2019 IDE. I am very close to success.

This project has the following lines in its CMakeList.txt file:

find_package(sqlite3)
if (SQLITE3_FOUND)
  message("Sqlite3 found")
  include_directories(${SQLite3_INCLUDE_DIRS})
  SET(CMAKE_CXX_FLAGS_RELEASE " -DSQLITE3 ${CMAKE_CXX_FLAGS_RELEASE}")
  SET(CMAKE_CXX_FLAGS_DEBUG " -DSQLITE3 ${CMAKE_CXX_FLAGS_DEBUG}")
  SET(CMAKE_EXE_LINKER_FLAGS "-lsqlite3")
  SET(CMAKE_SHARED_LINKER_FLAGS "-lsqlite3")
else()
  message("Sqlite3 not found")
endif (SQLITE3_FOUND)

I need lsqlite3. I found the source code but failed to compile it using GCC:

C:\Users\pc\Downloads\sqlite3\lsqlite3-master\lsqlite3-master>mingw32-make
FIND: Parameter format not correct
FIND: Parameter format not correct
luarocks make

Error: Please specify which rockspec file to use.
luarocks make

Error: Please specify which rockspec file to use.

C:\Users\pc\Downloads\sqlite3\lsqlite3-master\lsqlite3-master>mingw32-make lsqlite3complete-0.9.4-2.rockspec
mingw32-make: Nothing to be done for 'lsqlite3complete-0.9.4-2.rockspec'.

C:\Users\pc\Downloads\sqlite3\lsqlite3-master\lsqlite3-master>

The file lsqlite3.c contains #include "lua.h" and #include "lauxlib.h". It seems that they are from Lua for Windows project.

How can I compile lsqlite3 for Windows and link it to my existing CPP project's port?

Should it be compiled using GCC or Lua?

CodePudding user response:

You are horribly mistaken. The linker flag -lsqlite3 means "link with libsqlite3.so. The correct library to compile is SQLite3. If you have trouble compiling it on Windows, there are quite a few questions about it on SO.

  • Related