User forums > Help
SQLite3/C++11 Issues
Geowil:
After searching topics I have found none discussing how to add the pre-compiled sqlite3.lib into Code::Blocks.
I am attempting to add the lib file in for my project however so far all I am getting on compile are errors about how sqlite3 functions are undefined. I have added the path to the sqlite3.lib file into my build options -> linker settings, that path being SQLite3\sqlite3.lib, for both debug and release builds. Does Code::Blocks require something else besides this?
Edit:
I decided to try compiling SQLite3 myself as suggested in some of the other topics since maybe that pre-compiled lib will not work with g++. So I have the .a file now but the linker is still refusing to recognize it now saying that -lsqlite3_2 cannot be found (the file is named libsqlite3_2.a).
Edit 2:
I have now correctly named both the .a and .lib file as libsqlite3 however ld.exe still cannot find either of them. Is TDM's MinGW one of those that blows up on spaces in file paths?
Edit 3:
I am out of ideas now. Here are all of the settings (in the global compiler settings):
Linker Settings - Other Linker Options: -lsqlite3
Search Directories - Compiler: D:\Codeblocks\MinGW\SQLite3
Search Directories - Linker: D:\Codeblocks\MinGW\SQLite3
File names (in D:\Codeblocks\MinGW\SQLite3):
libsqlite3.a
_libsqlite3.lib
sqlite3.h
sqlite3.c
sqlite3.dll
shell.c
When I compile my project I still am getting the ld.exe -lsqlite3 not found error.
Jenna:
Please post the builkd log(!) of a full rebuild with full commandline enabled.
Geowil:
--- Quote from: jens on March 22, 2014, 08:53:30 am ---Please post the builkd log(!) of a full rebuild with full commandline enabled.
--- End quote ---
The entire log is too big to post but I think this is the problem:
--- Quote ---d:/codeblocks/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible D:\CodeBlocks\MinGW\SQLite3/libsqlite3.a when searching for -lsqlite3
d:/codeblocks/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible D:\CodeBlocks\MinGW\SQLite3/sqlite3.dll when searching for -lsqlite3
d:/codeblocks/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible D:\CodeBlocks\MinGW\SQLite3\libsqlite3.a when searching for -lsqlite3
d:/codeblocks/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible D:\CodeBlocks\MinGW\SQLite3/libsqlite3.a when searching for -lsqlite3
d:/codeblocks/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible D:\CodeBlocks\MinGW\SQLite3/sqlite3.dll when searching for -lsqlite3
d:/codeblocks/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lsqlite3
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 58 second(s))
1 error(s), 317 warning(s) (0 minute(s), 58 second(s))
--- End quote ---
Did some Googling and it seems that this means that the linker is stating that the built files do not match the type of the program (32-bit or 64-bit). I was using MinGw 4.8.1 64-bit but had built 32-bit libs for SQLite3 (could not get it to build as 64-bit). So I attempted again to get TDM-MinGW 4.8.1 32-bit to work but it is still giving me trouble with c++11:
--- Quote ---D:\Codeblocks\Projects\Space Crusade 0.5A Build 5\database.cpp:925:85: error: 'to_string' was not declared in this scope
dbug.createBReport("SQL Code 7","No column queried",bLocale + to_string(__LINE__),bTDate,"./SC_Log.txt");
^
D:\Codeblocks\Projects\Space Crusade 0.5A Build 5\database.cpp:933:86: error: 'to_string' was not declared in this scope
dbug.createBReport("SQL Code 8",sqlite3_errmsg(dBase),bLocale + to_string(__LINE__),bTDate,"./SC_Log.txt");
^
D:\Codeblocks\Projects\Space Crusade 0.5A Build 5\database.cpp:941:85: error: 'to_string' was not declared in this scope
dbug.createBReport("SQL Code 3",sqlite3_errmsg(dBase),bLocale + to_string(__LINE__),bTDate,"./SC_Log.txt");
^
D:\Codeblocks\Projects\Space Crusade 0.5A Build 5\database.cpp: In member function 'void Database::returnMesResult(std::vector<message>&)':
D:\Codeblocks\Projects\Space Crusade 0.5A Build 5\database.cpp:949:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (i = 0; i < mesResults.size(); i++)
^
D:\Codeblocks\Projects\Space Crusade 0.5A Build 5\database.cpp: In member function 'void Database::getPNResults(bool*)':
D:\Codeblocks\Projects\Space Crusade 0.5A Build 5\database.cpp:994:97: error: 'to_string' was not declared in this scope
dbug.createBReport("SQL Code 6","Data returned equals NULL",bLocale + to_string(__LINE__),bTDate,"./SC_Log.txt");
^
D:\Codeblocks\Projects\Space Crusade 0.5A Build 5\database.cpp:1009:86: error: 'to_string' was not declared in this scope
dbug.createBReport("SQL Code 7","No column queried",bLocale + to_string(__LINE__),bTDate,"./SC_Log.txt");
^
D:\Codeblocks\Projects\Space Crusade 0.5A Build 5\database.cpp:1018:81: error: 'to_string' was not declared in this scope
dbug.createBReport("SQL Code 8","No row queried",bLocale + to_string(__LINE__),bTDate,"./SC_Log.txt");
^
D:\Codeblocks\Projects\Space Crusade 0.5A Build 5\database.cpp:1026:85: error: 'to_string' was not declared in this scope
dbug.createBReport("SQL Code 3",sqlite3_errmsg(dBase),bLocale + to_string(__LINE__),bTDate,"./SC_Log.txt");
^
D:\Codeblocks\Projects\Space Crusade 0.5A Build 5\database.cpp: In member function 'void Database::returnPNResult(std::vector<planetName>&)':
D:\Codeblocks\Projects\Space Crusade 0.5A Build 5\database.cpp:1035:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (i = 0; i < pNResults.size(); i++)
^
D:\Codeblocks\Projects\Space Crusade 0.5A Build 5\database.cpp: In member function 'void Database::getDResults(bool*)':
D:\Codeblocks\Projects\Space Crusade 0.5A Build 5\database.cpp:1077:96: error: 'to_string' was not declared in this scope
dbug.createBReport("SQL Code 6","Data returned equals NULL",bLocale + to_string(__LINE__),bTDate,"./SC_Log.txt");
^
D:\Codeblocks\Projects\Space Crusade 0.5A Build 5\database.cpp:1092:85: error: 'to_string' was not declared in this scope
dbug.createBReport("SQL Code 7","No column queried",bLocale + to_string(__LINE__),bTDate,"./SC_Log.txt");
^
D:\Codeblocks\Projects\Space Crusade 0.5A Build 5\database.cpp:1100:81: error: 'to_string' was not declared in this scope
dbug.createBReport("SQL Code 8","No row queried",bLocale + to_string(__LINE__),bTDate,"./SC_Log.txt");
^
D:\Codeblocks\Projects\Space Crusade 0.5A Build 5\database.cpp:1108:85: error: 'to_string' was not declared in this scope
dbug.createBReport("SQL Code 3",sqlite3_errmsg(dBase),bLocale + to_string(__LINE__),bTDate,"./SC_Log.txt");
^
D:\Codeblocks\Projects\Space Crusade 0.5A Build 5\database.cpp: In member function 'void Database::returnDResult(std::vector<diplomacy>&)':
D:\Codeblocks\Projects\Space Crusade 0.5A Build 5\database.cpp:1116:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (i = 0; i < dResults.size(); i++)
^
D:\Codeblocks\Projects\Space Crusade 0.5A Build 5\database.cpp: In member function 'void Database::getRResults(bool*)':
D:\Codeblocks\Projects\Space Crusade 0.5A Build 5\database.cpp:1157:96: error: 'to_string' was not declared in this scope
dbug.createBReport("SQL Code 6","Data returned equals NULL",bLocale + to_string(__LINE__),bTDate,"./SC_Log.txt");
^
D:\Codeblocks\Projects\Space Crusade 0.5A Build 5\database.cpp:1172:85: error: 'to_string' was not declared in this scope
dbug.createBReport("SQL Code 7","No column queried",bLocale + to_string(__LINE__),bTDate,"./SC_Log.txt");
^
D:\Codeblocks\Projects\Space Crusade 0.5A Build 5\database.cpp:1180:81: error: 'to_string' was not declared in this scope
dbug.createBReport("SQL Code 8","No row queried",bLocale + to_string(__LINE__),bTDate,"./SC_Log.txt");
^
D:\Codeblocks\Projects\Space Crusade 0.5A Build 5\database.cpp:1188:85: error: 'to_string' was not declared in this scope
dbug.createBReport("SQL Code 3",sqlite3_errmsg(dBase),bLocale + to_string(__LINE__),bTDate,"./SC_Log.txt");
^
D:\Codeblocks\Projects\Space Crusade 0.5A Build 5\database.cpp: In member function 'void Database::returnRResult(std::vector<ranks>&)':
D:\Codeblocks\Projects\Space Crusade 0.5A Build 5\database.cpp:1196:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (i = 0; i < rResults.size(); i++)
^
D:\Codeblocks\Projects\Space Crusade 0.5A Build 5\database.cpp: In member function 'void Database::getRcResults(bool*)':
D:\Codeblocks\Projects\Space Crusade 0.5A Build 5\database.cpp:1238:96: error: 'to_string' was not declared in this scope
dbug.createBReport("SQL Code 6","Data returned equals NULL",bLocale + to_string(__LINE__),bTDate,"./SC_Log.txt");
^
D:\Codeblocks\Projects\Space Crusade 0.5A Build 5\database.cpp:1253:85: error: 'to_string' was not declared in this scope
dbug.createBReport("SQL Code 7","No column queried",bLocale + to_string(__LINE__),bTDate,"./SC_Log.txt");
^
D:\Codeblocks\Projects\Space Crusade 0.5A Build 5\database.cpp:1261:81: error: 'to_string' was not declared in this scope
dbug.createBReport("SQL Code 8","No row queried",bLocale + to_string(__LINE__),bTDate,"./SC_Log.txt");
^
D:\Codeblocks\Projects\Space Crusade 0.5A Build 5\database.cpp:1269:85: error: 'to_string' was not declared in this scope
dbug.createBReport("SQL Code 3",sqlite3_errmsg(dBase),bLocale + to_string(__LINE__),bTDate,"./SC_Log.txt");
--- End quote ---
The toolchain is as follows:
C Compiler: mingw32-gcc-4.8.1.exe
C++ Compliler: mingw32-g++.exe
Linker for Dynamic Libs: mingw32-g++.exe
Linker for Static Libs: mingw32-gcc-ar.exe
Debugger: GDB/CDB Debugger : Default
Resource Compiler: windres.exe
Make Program: mingw32-make.exe
The c++11 flag is checked:
--- Quote ---mingw32-c++.exe -Wall -fexceptions -std=c++11 -g -std=c++11 -ID:\CodeBlocks\MinGW\SQLite3 -c "D:\Codeblocks\Projects\Space Crusade 0.5A Build 5\database.cpp"
--- End quote ---
Jenna:
If you have more than one MinGW installation, make sure none of them is in [anydrive]:\MinGW or the chosen installation might pick up incorrect libs.
This is a MinGW issue.
Chosing e.g \Mingw32 and \MinGW64 for 32- and 64-bit should work.
Jenna:
See also this thread: http://forums.codeblocks.org/index.php/topic,19068.msg130636/topicseen.html#msg130636
Navigation
[0] Message Index
[#] Next page
Go to full version