Tell me more ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have downloaded SQLite C/C++ interface to work with Cocos2d-x. Created a database by Firefox SQLite plugin. Then tried the following code

    // sqlite implementation
    sqlite3 *db;

    if(sqlite3_open("testdb.sqlite",&db) == SQLITE_OK){
        NSLog(@"Opened db Successfully");
    } else {
        NSLog(@"Failed to open");
    }

Output is # Failed to open

How to solve the issue?

share|improve this question

1 Answer

up vote 1 down vote accepted

Well, you should start by checking the error code returned by sqlite3_open. Different codes are there for a reason to suggest what the error might be.

I for one guess that the file was not found. Very often the current directory is not what you expect, and is oftent different on different platforms.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.