简体   繁体   English

如何为 Windows 编译 lsqlite3?

[英]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.

相关问题 在vscode for c++中使用sqlite3(undefined reference to `xxx')(我有使用-lsqlite3) - Use sqlite3 in vscode for c++(undefined reference to `xxx')(I have use -lsqlite3) 如何在Windows中编译Gnu C - How can I compile Gnu C in windows 如何在Windows上下载,编译和执行一个简单的ImageMagick(++) - How can I download, compile and execute a simple ImageMagick (++) on Windows 如何在Windows上为ARM编译C ++库 - How can i compile a c++ library for ARM on windows 如何从命令行(Windows 7)编译和运行项目? - How can I compile and run project from command line(Windows 7)? 如何将我正在交叉编译的程序的ubuntu上的GLEW交叉编译到Windows? - How can I cross-compile GLEW on ubuntu to windows for a program I am cross-compiling? 我在 Windows 上构建了一个 C++ 程序,如何为 MacOS 编译可执行文件? - I built a C++ program on Windows, how can I compile an executable for MacOS? 我可以在Windows RT和Windows Phone 8上JBT编译代码吗 - Can I JBT compile code on Windows RT and Windows Phone 8 如何在Windows中编译Thrift? 我有错误 - How to compile thrift in Windows? I got errors 如何在WIndows上使用Cython编译Pyparsing? - How do I compile Pyparsing with Cython on WIndows?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM