为 Windows Mobile 设备编译 SQLite 合并
如何为 Windows Mobile 设备编译 SQLite 合并?
然后我想在控制台中使用来运行一些命令。
我已经在 C/C++ 中为智能设备创建了一个空的 VS 项目,然后将现有文件包含到源和标头中。
当我尝试编译时,我得到: 错误1错误LNK2019:函数mainWCRTStartup corelibc.lib sqlite3中引用了无法解析的外部符号wmain
How can I compile the SQLite amalgamation for Windows Mobile device?
Then I want to use in a console to run some commands.
I've created an empty VS project in C/C++ for Smart Device, then included the existing files into Sources and Headers.
When I try to compile I get:Error 1 error LNK2019: unresolved external symbol wmain referenced in function mainWCRTStartup corelibc.lib sqlite3
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
合并文件不包含
main
函数,因为它实际上只是sqlite库,而不是命令行界面程序。您必须自己实现这些命令并链接到 sqlite 库。
The amalgamation file does not contain a
main
function because it's really just the sqlite library, and not a command-line interface program.You will have to implement the commands yourself and link against the sqlite library.
wmain函数是程序执行入口函数,意味着由应用程序定义,而不是由库定义。
您很可能已经为应用程序创建了一个项目,但 SQLite 是一个库,因此它没有定义(w)main 函数。因此,您应该选择静态库或
动态链接库
项目类型。您最好参考有关为 Windows Mobile 应用程序创建和设置项目的 MSDN 文档,并决定 选择哪种项目类型
智能设备开发
The wmain function is a program execution entry function, means is defined by an application, but not a library.
You most likely have crated a project for Application but SQLite is a library, so it does not define (w)main function. So, you should select project type of Static Library or
Dynamic-Linked Library
.You'd be better to refer to the MSDN documentation about creating and setting projects for Windows Mobile applications and decide which project type to choose
Smart Device Development
您可以将 SQLite Amalgamation 构建为库并链接到它...但是,如果您正在编写本机 C++ 应用程序,那么将 SQLite 直接编译到您的项目中会容易容易得多。
首先,按照项目向导设置并创建一个“Windows应用程序”并选择“Emply Project”。选择“无 ATL”、“无 MFC”和“无预编译头”。
成功构建空/骨架项目后,将 SQLite Amalagamation 中的
sqlite3.c
和sqlite3.h
添加到项目中。在包含
wmain()
的 .CPP 文件中添加#include "sqlite3.h"
最后,在您的
wmain()
函数中的某处 <在初始化代码之后但在主消息循环之前添加以下内容:这是创建空内存 SQLite 数据库的最低限度必要代码。
如果上面的项目编译并链接 - 你应该可以开始了!
You could build the SQLite Amalgamation as a library and link against it... But if you're writing a native C++ application it's much easier to just compile SQLite directly into your project.
First, follow the project wizard settings and create a "Windows Application" and choose "Emply Project". Choose No ATL, no MFC and no Precompiled-Headers.
Once you have the empty/skeleton project building successfully, add
sqlite3.c
andsqlite3.h
from the SQLite Amalagamation to the project.In the .CPP file that contains
wmain()
add#include "sqlite3.h"
Finally, in your
wmain()
function, somewhere after the initialization code but before the main message loop add the following:This is the bare-minimum necessary code to create an empty in-memory SQLite database.
If the above project compiles and links - you should be good to go!