0

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
  • 1
    Ok, I really need to dig out that copy of the K&R book and actually learn to use pointers. Commented Jan 28, 2009 at 21:58

3 Answers 3

2

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

Sign up to request clarification or add additional context in comments.

Comments

1

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.

1 Comment

Objective-C is a strict superset of C.
1

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

sqlite3_close(db);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.