I’m getting errors in xcode saying:
No viable overload '='
I am trying to iterate through some code and it doesn’t work.
Below is the code:
string query;
query = "select name from A;";
sqlite3_stmt *sqlstmt;
if(SQLITE_OK != sqlite3_prepare16_v2(db, query.c_str(),0, &sqlstmt,0)){
sqlite3_close(db);
return -1;
}
while(sqlite3_step(sqlstmt) == SQLITE_ROW){
string name;
name = sqlite3_column_text16(sqlstmt, 1); //<--errors
cout << name << endl;
}
Edit: I added the query
sqlite3_column_text16()returns avoid const *, not a string. Try this:Note that the *16 family of functions use UTF-16, so this is unlikely to work with standard strings; you’ll have to use wide strings, or the non-16 variant: