views:

324

answers:

3

When i try to compile this as part of an objective-c program it gives the warning:
warning: passing argument 1 of 'sqlite3_close' from incompatible pointer type

sqlite3 *db;
sqlite3_open("~/Documents/testdb.sqlite", &db);
/*stuff*/
sqlite3_close(&db);

An almost identical error is given with nearly any other function call that uses &db.

+1  A: 

You should just pass in the pointer, not a reference to it:

sqlite3_close(db);
Ates Goral
+1  A: 

I don't think you need the second &... If this is anything like plain c, you just want to call sqlite3_close(db); (Thereby passing it the pointer itself, rather than the address of the pointer.) The sqlite3_open call would, I believe, be left as is.

Kim Reece
Objective-C is a strict superset of C.
GameFreak
+2  A: 

sqlite3_close requires a sqlite3*, not a sqlite3**. So drop the ampersand and it should compile.

David Grant