Now I'm geting an error:
1>c:\development\document_manager\document_manager\storage_manager.h(7) : error C2079: 'storage_manager::db' uses undefined struct 'sqlite3'
with
#pragma once
#include "sqlite3.h"
class storage_manager
{
sqlite3 db;
sqlite3** db_pp;
public:
void open()
{
sqlite3_open("data.db", db_pp);
}
};
Old Question: Hi everyone. I downloaded sqlite-amalgamation-3_6_13.zip from http://www.sqlite.org/download.html, but I'm not able to compile it in my project. I receive many errors like:
c:\pathtoproject\sqlite3.c(11337) : error C2440: '=' : cannot convert from 'void *' to 'char *'
Conversion from 'void*' to pointer to non-'void' requires an explicit cast
c:\pathtoproject\sqlite3.c(12023) : error C2440: '=' : cannot convert from 'void *' to 'sqlite3_int64 *'
Conversion from 'void*' to pointer to non-'void' requires an explicit cast
What do I need to do to compile my project properly? Thanks!
Edit: I don't want to compile the whole program as C, I just want to compile three files as c, is this possible?
EDIT: FIXED! I created an new project.
-
Doesn't the compiler tell you what to do? You need an explicit cast:
void *pv = /* some value */; char *pc = (char*) pv;This is of course not a problem in C, but an issue of C++.
LM : I don't think I'd like to go through 15000+ lines of sqlite to add explicit casts, so how would I make VC++ interpret the file as a c code file?dirkgently : Goto Project Properties> C/C++ > Advanced > Compile As > Compile as C code. -
It looks like you might be trying to compile a C program using a C++ compiler. While there is a lot of C code which is also valid C++, they are different languages.
Your compiler may have some switch or setting to compile C code. Check your compiler documentation.
-
You need to compile the file as C code rather than C++. Right click on either the project or just the .c file, and in properties, make sure it is set to compile as C, rather than C++. (You may want to set this setting just for the file, not the entire project)
LM : The sqlite3.c file is already set to compile as C. What do I do?jalf : I kind of expected that (it should be set to C by default for .c files), but it's strange. My VC2k8 compiles it just fine. You're not #including the .c file directly, are you?
0 comments:
Post a Comment