Hello everyone.
While not new to Code::Blocks and SQLite3, I have never until today tried
to use them together. I am having a problem getting my proof-of-concept
code to compile. Any assistance would be appreciated.
First, my environment:
- WinXP
- Code::Blocks 8.02 w/ MinGW compiler
- wxWidgets 2.8.9
- SQLite3 3.6.11
What I have done:
- Set up a wxWidget project
- Designed a frame
- Added a few menu bar items
- added a procedure to a menu pick that will test for a SQLite3 db
- Compile time '#include' references: 'sqlite3.h' & 'sqlite3ext.h'
- Execution library references include 'sqlite3.dll'
In the module that is accessed by the menu pick event, I have the
following:
...
#include "wx_pch.h"
#include "CallSQLiteMain.h"
#include <wx/msgdlg.h>
#include "sqlite3ext.h"
...
The event procedure I am using for testing is:
void CallSQLiteFrame::OnFileCallDLLSelected(wxCommandEvent& event)
{
sqlite3 *db;
char *zErrMsg = 0;
int rc;
rc = sqlite3_open("menuscrn.db", &db);
if( rc ){
sqlite3_malloc(255);
sprintf(zErrMsg, "Can't open database: %s; status=%d\n",
sqlite3_errmsg(db),rc);
SetStatusText(wxString::Format(_T("SQL error: %s\n"), zErrMsg),1);
sqlite3_close(db);
sqlite3_free(zErrMsg);
return;
}
sqlite3_close(db);
return;
}
Comments and questions ...
If I '#ifdef' out the code in the procedure, the program compiles cleanly,
which is expected. This proves the C::B project is set up properly.
If I include the code, I get the following single error:
"error: 'sqlite3_api' was not declared in this scope"
This means that the header information is being located correctly and
processed, but there may be a namespace issue. Or something else ...
This begs the question: I know SQLite3 is a 'c' safe app because I use it
for other projects under *nix. But can it be used directly in a 'c++'
situation under Windoze?
Or do I need a 'wrapper' of some kind?
Or a compile time option to be set/reset?
Lastly, while doing some internet research I have seen some issues with
the 'DLL' being set at a fixed address. I know those articles were a year
or two old, but is that still an issue? Do I need to somehow manipulate
the 'sqlite3.dll' before I can use it under Windoze?
Again thanks for any assisstance ...
GAFling
2009-03-22
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users