|
From: SlackRat <ab...@to...> - 2005-02-27 01:20:04
|
I seem to be having some trouble linking a small test programme as =
included below.
I am totally new to Windows and am sure that I have missed something =
elementary.
I obtained sqlite and have installed:
windows98(2)
dev-c++ 4.9.9.2 (latest modified version)
sqlite-3.1.3.zip
sqlitedll-3.1.3.zip
sqlite-source.zip
The sqlite3.h that I am using I took directly from the sqlite-source =
package
The programme compiles fine but the linker advises:
" cannot find -lobjc " and ld exits with status 1
I have a copy of libobjc.a in cygwin/lib/mingw and copied it to=20
c:/dev-cpp/lib/gcc/mingw32/3.4.2 as lobjc.a
but this is not working
Any help would be greatly appreciated
// testsql.c
#include <stdio.h>
#include "sqlite3.h"
static int callback(void *NotUsed, int argc, char **argv, char =
**azColName){
int i;
for(i=3D0; i<argc; i++){
printf("%s =3D %s\n", azColName[i], argv[i] ? argv[i] : "NULL");
}
printf("\n");
return 0;
}
int main(int argc, char **argv){
sqlite3 *db;
char *zErrMsg =3D 0;
int rc;
if( argc!=3D3 ){
fprintf(stderr, "Usage: %s DATABASE SQL-STATEMENT\n", argv[0]);
exit(1);
}
rc =3D sqlite3_open(argv[1], &db);
if( rc ){
fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(db));
sqlite3_close(db);
exit(1);
}
rc =3D sqlite3_exec(db, argv[2], callback, 0, &zErrMsg);
if( rc!=3DSQLITE_OK ){
fprintf(stderr, "SQL error: %s\n", zErrMsg);
}
sqlite3_close(db);
return 0;
}
// eof
.
--
Slackrat |