views:

290

answers:

3

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

+2  A: 

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.

AndiDog
A: 

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

mloskot
A: 

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 and sqlite3.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:

sqlite3 *db;
sqlite3_open(":memory:", &db);

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!

Kassini