在 MSVC 中编译 SQLite RTREE? [英] Compiling SQLite RTREE in MSVC?

查看:41
本文介绍了在 MSVC 中编译 SQLite RTREE?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从源代码编译 SQLite 的 rtree 扩展.自述文件包括以下说明:

I need to compile the rtree extension for SQLite from source code. The readme includes these instructions:

编译和使用 RTREE 扩展的最简单方法是构建并将其用作可动态加载的 SQLite 扩展.要做到这一点在 *nix 上使用 gcc:

The easiest way to compile and use the RTREE extension is to build and use it as a dynamically loadable SQLite extension. To do this using gcc on *nix:

gcc -shared rtree.c -o libSqliteRtree.so

您可能需要添加-I"标志,以便 gcc 可以找到 sqlite3ext.h和 sqlite3.h.生成的共享库 libSqliteRtree.so 可能是以与任何其他动态加载相同的方式加载到 sqlite扩展名.

You may need to add "-I" flags so that gcc can find sqlite3ext.h and sqlite3.h. The resulting shared lib, libSqliteRtree.so, may be loaded into sqlite in the same way as any other dynamicly loadable extension.

我遇到的问题是我使用的是 Windows,而不是 Linux,因此需要使用 MSVC.我试过了:

Problem I'm having is that I'm on Windows, not Linux, and so need to use MSVC. I tried:

cl rtree.c -link -out:libSqliteRtree.so

这给了 cannot open include file 错误,直到我找到它抱怨的各种 .h 文件并将它们移动到同一目录中.然而,现在它变成了:

This gave cannot open include file errors until I found the various .h files it was complaining about and moved them into the same directory. Now, however, it's gotten to:

/out:rtree.exe
-out:libSqliteRtree.so
rtree.obj
创建库 libSqliteRtree.lib 和对象 libSqliteRtree.exp
链接:致命错误 LNK1561:必须定义入口点

/out:rtree.exe
-out:libSqliteRtree.so
rtree.obj
Creating library libSqliteRtree.lib and object libSqliteRtree.exp
LINK : fatal error LNK1561: entry point must be defined

我承认我在编译器中所做的事情几乎为零,而且我不知道从哪里开始解决它的问题.我是否将编译器标志从 GCC 正确翻译"到 MSVC?我还能调整什么来尝试从源代码中获取 SQLite 扩展?我是否应该向拥有 Linux 服务器的团队中的开发人员请求帮助并让他们为我做这件事?

I admit I have pretty much zero clue what I'm doing in a compiler, and I'm not sure where to go from here to resolve its problem. Am I "translating" the compiler flags correctly from GCC to MSVC? What else can I tweak to try to get the SQLite extension out of the source code? Should I beg a favor from a developer on ateam with a Linux server and ask them to do it for me?

推荐答案

感谢 Shawn 评论查看 SQLite Run-Time Loadable Extensions 文档,其中包含更多信息:

Thanks to Shawn for commenting to look at the SQLite Run-Time Loadable Extensions documentation, which had more information in it:

要使用 MSVC 在 Windows 上进行编译,通常可以使用类似于以下内容的命令:

To compile on Windows using MSVC, a command similar to the following will usually work:

cl YourCode.c -link -dll -out:YourCode.dll

所以对于我的情况:cl rtree.c -link -dll -out:libSqliteRtree.dll 有效.

So for my situation: cl rtree.c -link -dll -out:libSqliteRtree.dll worked.

这篇关于在 MSVC 中编译 SQLite RTREE?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆