[英]How can I compile lsqlite3 for Windows?
I have a C++ project developed in Ubuntu Linux.我有一个在 Ubuntu Linux 中开发的 C++ 项目。 This C++ project is not written by me.这个 C++ 项目不是我写的。 Also, it runs under Ubuntu without any issues.此外,它在 Ubuntu 下运行没有任何问题。
I am trying to compile the project under Windows 10 using GCC/G++ compiler and Visual Studio 2019 IDE.我正在尝试使用 GCC/G++ 编译器和 Visual Studio 2019 IDE 在 Windows 10 下编译项目。 I am very close to success.我离成功很近了。
This project has the following lines in its CMakeList.txt file:该项目的CMakeList.txt文件中有以下几行:
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 .我需要lsqlite3 。 I found the source code but failed to compile it using GCC:我找到了源代码,但是使用 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"
.文件lsqlite3.c包含#include "lua.h"
和#include "lauxlib.h"
。 It seems that they are from Lua for Windows project.似乎它们来自Lua for Windows项目。
How can I compile lsqlite3 for Windows and link it to my existing CPP project's port?如何为 Windows 编译lsqlite3并将其链接到我现有的 CPP 项目的端口?
Should it be compiled using GCC or Lua?它应该使用 GCC 还是 Lua 编译?
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.链接器标志-lsqlite3
表示“与libsqlite3.so
链接。要编译的正确库是SQLite3 。如果您在 Windows 上编译时遇到问题,那么在 SO 上有很多关于它的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.