I am struggling my way through making daal work in my project, and have now come across the following error - I am struggling to make any sense of it and not quite sure where to even start with debugging.
I am trying to replicate this website's code: https://www.codeproject.com/Articles/1151606/Lightning-Fast-R-Machine-Learning-Algorithms but in Windows 10, and have the following software (exactly as per the website):
Intel DAAL 2017 Beta update 1
R version 3.3.1 (Bug in Your Hair)
Rcpp package version 0.12.5
Inline package version 0.3.14
e1071 package version 1.6-7
I have done the following:
copied the daal packages from C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\daal\include into the Include for R
followed the instructions in https://software.intel.com/en-us/get-started-with-daal-for-windows
The following is the error I am getting - please help me someone as I am struggling!
file473877c213b9.cpp: In function 'SEXPREC* file473877c213b9(SEXP, SEXP)':
file473877c213b9.cpp:37:49: error: incomplete universal character name \U
std::string fname = Rcpp::as<std::string>(-"C:\Users\Documents\BAJAJ.csv");
^
file473877c213b9.cpp:37:49: warning: unknown escape sequence: '\D'
file473877c213b9.cpp:37:49: warning: unknown escape sequence: '\B'
file473877c213b9.cpp:37:49: error: wrong type argument to unary minus
file473877c213b9.cpp:38:29: error: no matching function for call to 'as(int)'
int k = Rcpp::as<int>(7);
---------------------------------------------------------------------------------
make: *** [file473877c213b9.o] Error 1
Warning message:
running command 'make -f "C:/R/R-33~1.1/etc/x64/Makeconf" -f "C:/R/R-33~1.1/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="file473877c213b9.dll" WIN=64 TCLBIN=64 OBJECTS="file473877c213b9.o"' had status 2
---------------------------------------------------------------------------------
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! In file included from file3f9022477144.cpp:3:0:
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\daal\include\daal.h:25:0: warning: ignoring #pragma warning [-Wunknown-pragmas]
#pragma warning(disable:809)
^
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\daal\include\daal.h:38:0: warning: ignoring #pragma comment [-Wunknown-pragmas]
#pragma comment(lib, "tbb.lib" )
^
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\daal\include\daal.h:39:0: warning: ignoring #pragma comment [-Wunknown-pragmas]
#pragma comment(lib, "tbbmalloc.lib" )
^
In file included from C:/R/R-33~1.1/include/data_management/data/data_dictionary.h:35:0,
from C:/R/R-33~1.1/include/data_management/data_source/data_source.h:33,
from C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\daal\in
In addition: Warning message:
running command 'C:/R/R-33~1.1/bin/x64/R CMD SHLIB file3f9022477144.cpp 2> file3f9022477144.cpp.err.txt' had status 1
Many thanks in advance for any help anyone can provide (i'm not a coder so am struggling!)
Keyur
edit 21 July 2018 - excerpts of my code to provide further details
library(Rcpp)
library(inline)
# Create and register a Rcpp plugin
plug <- Rcpp:::Rcpp.plugin.maker(
include.before = "#include <C:\\Program Files (x86)\\IntelSWTools\\compilers_and_libraries_2017.1.143\\windows\\daal\\include\\daal.h> ",
libs = paste("/Qdaal[-C:\\Program Files (x86)\\IntelSWTools\\compilers_and_libraries_2017.1.143\\windows\\daal\\lib\\intel64_win\\daal_core.lib]",
"/Qdaal[-C:\\Program Files (x86)\\IntelSWTools\\compilers_and_libraries_2017.1.143\\windows\\daal\\lib\\intel64_win\\daal_thread.lib]", sep=""))
registerPlugin("daalNB", plug)
# load data
readCSV <- '
using namespace daal;
using namespace daal::data_management;
// Inputs:
// file - file name
// ncols - number of columns in file
std::string fname = Rcpp::as<std::string>("C://Users//Documents//BAJAJ.csv");
int k = Rcpp::as<int>(7);......***rest of the code as per the website referenced above, ie same code for the readCSV, train and predict functions***
Functions to actually call the functions:
# R function for loading data and labels
loadData <- cxxfunction(signature(file="character", ncols="integer"),readCSV, plugin="daalNB")
# R function for training a model
nbTrain <- cxxfunction(signature(X="raw", y="raw", nclasses="integer"),
train, plugin="daalNB")
# R function for scoring
nbPredict <- cxxfunction(signature(model="raw", X="raw", nclasses="integer"),
predict, plugin="daalNB")
The errors I am getting in relation to the readCSV <- function:
C:/Users/Documents/R/win-library/3.3/Rcpp/include/Rcpp/as.h:151:29: note: template argument deduction/substitution failed:
file40e81ac24329.cpp:36:89: note: cannot convert '"C://Users//Documents//BAJAJ.csv"' (type 'const char [40]') to type 'SEXP'
std::string fname = Rcpp::as<std::string>("C://Users//Documents//BAJAJ.csv");
^
file40e81ac24329.cpp:37:29: error: no matching function for call to 'as(int)'
int k = Rcpp::as<int>(7);
make: *** [file40e81ac24329.o] Error 1
Warning message:
running command 'make -f "C:/R/R-33~1.1/etc/x64/Makeconf" -f "C:/R/R-33~1.1/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="file40e81ac24329.dll" WIN=64 TCLBIN=64 OBJECTS="file40e81ac24329.o"' had status 2
ERROR(s) during compilation: source code errors or compiler configuration errors!
The below error summmary appears in red in the R Studio console:
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! In file included from file40e81ac24329.cpp:3:0:
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\daal\include\daal.h:25:0: warning: ignoring #pragma warning [-Wunknown-pragmas]
#pragma warning(disable:809)
^
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\daal\include\daal.h:38:0: warning: ignoring #pragma comment [-Wunknown-pragmas]
#pragma comment(lib, "tbb.lib" )
^
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\daal\include\daal.h:39:0: warning: ignoring #pragma comment [-Wunknown-pragmas]
#pragma comment(lib, "tbbmalloc.lib" )
^
In file included from C:/R/R-33~1.1/include/data_management/data/data_dictionary.h:35:0,
from C:/R/R-33~1.1/include/data_management/data_source/data_source.h:33,
from C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\daal\in
In addition: Warning message:
running command 'C:/R/R-33~1.1/bin/x64/R CMD SHLIB file40e81ac24329.cpp 2> file40e81ac24329.cpp.err.txt' had status 1
Edit - 23 July 2018
I made the changes to the csv path as suggested by Ralf, and also inserted the following in the Makevars.win file:
CXX=C:/IntelSWTools2018/compilers_and_libraries_2018.3.210/windows/bin/intel64/icl.exe
CXXFLAGS=-I"C:/IntelSWTools2018/compilers_and_libraries_2018.3.210/windows/daal/include" -I"C:/IntelSWTools2018/compilers_and_libraries_2018.3.210/windows/compiler/include" -I"C:/Program Files (x86)/Windows Kits/10/Include/10.0.10240.0/ucrt" -I"C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include
Now am getting the following errors:
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 18.0.3.210 Build 20180410
Copyright (C) 1985-2018 Intel Corporation. All rights reserved.
icl: NOTE: The evaluation period for this product ends on 4-aug-2018 UTC.
compilation aborted for file35d0134c2a9d.cpp (code 2)
make: *** [file35d0134c2a9d.o] Error 2
Warning message:
running command 'make -f "C:/R/R-33~1.1/etc/x64/Makeconf" -f "C:/R/R-33~1.1/share/make/winshlib.mk" -f "C:/Users/Documents/.R/Makevars.win" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="file35d0134c2a9d.dll" WIN=64 TCLBIN=64 OBJECTS="file35d0134c2a9d.o"' had status 2
In addition: Warning message:
running command 'C:/R/R-33~1.1/bin/x64/R CMD SHLIB file35d0134c2a9d.cpp 2> file35d0134c2a9d.cpp.err.txt' had status 1
I can see a few lines in the code which suggest some issues, but cant make head or tail of these:
C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include/xmmintrin.h(61): error #2277: invalid definition of __m128; use #include "xmmintrin.h" instead
C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include/xlocale(341): warning #583: C++ exception handler found but /EHsc option was not specified
C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include/xlocale(367): warning #583: C++ exception handler found but /EHsc option was not specified
C:/Users/Documents/R/win-library/3.3/Rcpp/include/Rcpp/internal/NAComparator.h(62): error: expected a ")"
C:/Users/Documents/R/win-library/3.3/Rcpp/include/Rcpp/r_cast.h(32): warning #583: C++ exception handler found but /EHsc option was not specified
C:/Users/Documents/R/win-library/3.3/Rcpp/include/Rcpp/module/Module_generated_CppFunction.h(53): warning #583: C++ exception handler found but /EHsc option was not specified
C:/Users/Documents/R/win-library/3.3/Rcpp/include/Rcpp/module/Module_generated_CppFunction.h(93): warning #583: C++ exception handler found but /EHsc option was not specified
C:/Users/Documents/R/win-library/3.3/Rcpp/include/Rcpp/api/meat/module/Module.h(40): warning #583: C++ exception handler found but /EHsc option was not specified
C:/Users/Documents/R/win-library/3.3/Rcpp/include/Rcpp/api/meat/module/Module.h(40): warning #583: C++ exception handler found but /EHsc option was not specified
C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include/xstring(2195): warning #583: C++ exception handler found but /EHsc option was not specified
Edit 25 July 2018
Have now gone back to the exact packages daal versions noted in the website (very old!), and changed the CSV path as per Ralf's suggestion, and am getting the following compilation errors:
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! file2ddc1463da6.o:file2ddc1463da6.cpp:(.text+0x2e6): undefined reference to `daal::data_management::interface1::SerializationIface::serialize(daal::data_management::interface1::InputDataArchive&)'
file2ddc1463da6.o:file2ddc1463da6.cpp:(.text+0x304): undefined reference to `daal::data_management::interface1::SerializationIface::serialize(daal::data_management::interface1::InputDataArchive&)'
file2ddc1463da6.o:file2ddc1463da6.cpp:(.text$_ZN4daal15data_management10interface118SerializationIfacenwEy[_ZN4daal15data_management10interface118SerializationIfacenwEy]+0x16): undefined reference to `daal::services::daal_malloc(unsigned long long, unsigned long long)'
file2ddc1463da6.o:file2ddc1463da6.cpp:(.text$_ZN4daal15data_management10interface118SerializationIfacenaEy[_ZN4daal15data_management10interface118SerializationIfacenaEy]+0x16): undefined reference to `daal::services::daal_malloc(unsigned long long, unsigned long long)'
fi
The source of these are a tonne of lines such as:
file2ddc1463da6.o:file2ddc1463da6.cpp:(.text+0x2e6): undefined reference to `daal::data_management::interface1::SerializationIface::serialize(daal::data_management::interface1::InputDataArchive&)'
file2ddc1463da6.o:file2ddc1463da6.cpp:(.text+0x304): undefined reference to `daal::data_management::interface1::SerializationIface::serialize(daal::data_management::interface1::InputDataArchive&)'
file2ddc1463da6.o:file2ddc1463da6.cpp:(.text$_ZN4daal15data_management10interface118SerializationIfacenwEy[_ZN4daal15data_management10interface118SerializationIfacenwEy]+0x16): undefined reference to `daal::services::daal_malloc(unsigned long long, unsigned long long)'
file2ddc1463da6.o:file2ddc1463da6.cpp:(.text$_ZN4daal15data_management10interface118SerializationIfacenaEy[_ZN4daal15data_management10interface118SerializationIfacenaEy]+0x16): undefined reference to `daal::services::daal_malloc(unsigned long long, unsigned long long)'
file2ddc1463da6.o:file2ddc1463da6.cpp:(.text$_ZN4daal15data_management10interface118SerializationIfacedlEPvy[_ZN4daal15data_management10interface118SerializationIfacedlEPvy]+0x15): undefined reference to `daal::services::daal_free(void*)'
The Rcpp::as function you use is needed to convert between an R internal data type (SEXP) and normal C++ data types (int, string, ...). This is needed when you pass arguments from R to your C++ function. Since you specify the parameter in the C++ code, you do not need this function. The following should work in your readCsv function:
std::string fname = "C:/Users/Documents/BAJAJ.csv";
int k = 7;
Alternatively you can stick to the version from the tutorial where these parameters are passed in from R.
BTW, you don’t need to double /. Only \ has a special meaning and has to be doubled to refer to the literal version.
Related
I use the current Release of the Poco Library (1.12.0)
With that release i was unable to build the following Program with Visual Studio 2019 and 2022 (Platformtoolset vs142 and vs143):
#include <iostream>
#include <Poco/Any.h>
int main() {
Poco::Any any_type;
std::cout << "Test\n";
}
If i run the Compiler i got the following Error:
C:\Users\User\Documents\Unterlagen\Projekte\programming\cpp\_libraries\poco\Foundation\include\Poco\Any.h(124,1): fatal error C1001: Internal compiler error.
1>(compiler file 'msc1.cpp', line 1693)
1> To work around this problem, try simplifying or changing the program near the locations listed above.
1>If possible please provide a repro here: https://developercommunity.visualstudio.com
1>Please choose the Technical Support command on the Visual C++
1> Help menu, or open the Technical Support help file for more information
1>C:\Users\User\Documents\Unterlagen\Projekte\programming\cpp\_libraries\poco\Foundation\include\Poco\Any.h(210): message : see reference to class template instantiation 'Poco::Placeholder<PlaceholderT,SizeV>' being compiled
1>INTERNAL COMPILER ERROR in 'C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.32.31326\bin\HostX64\x64\CL.exe'
1> Please choose the Technical Support command on the Visual C++
1> Help menu, or open the Technical Support help file for more information
1>Done building project "Project1.vcxproj" -- FAILED.
I found out that the error occured because of the /Zc:twoPhase Option which is set by the /permissive- Option which is by default set. If i add /Zc:twoPhase- to disable the Two-Phase Lookup the code compiles successfully.
But i want to fix this issue inside the Any.h.
This is the Code which is mentioned in the Error:
template<typename T, typename V,
typename std::enable_if<TypeSizeGT<T, Placeholder::Size::value>::value>::type* = nullptr>
PlaceholderT* assign(const V& value)
==> {
erase();
pHolder = new T(value);
setLocal(false);
return pHolder;
}
The Arrow indicates the Line the Compiler mentioned.
I guess i need to add something to the Function Decleration but i'm not so deep inside templates.
Does anybody knows what i had to add so that MSVC is not complaining anymore??
I'm struggling with the importation of C++ (2017) dlls in Matlab (2019a).
In particular, since I'm not familiar with C++, I tried to create the MathLibrary defined in https://github.com/MicrosoftDocs/cpp-docs/blob/master/docs/build/walkthrough-creating-and-using-a-dynamic-link-library-cpp.md.
I created the library according to the guide, compiled both Debug and Release (x86), and the import with the MathClient described works fine.
However, I tried to import the library in Matlab (after adding the needed folders to the current path) with:
if libisloaded('MathLibrary') == 0
handle = loadlibrary('MathLibrary.dll','MathLibrary.h');
end
and it throws a tons of errors:
Warning: Message from C preprocessor:
cl : command line warning D9027: source file 'C:\Users\miche\source\repos\MathLibrary\Release\MathLibrary.lib' ignored
cl : command line warning D9021 : no operation performed
> In loadlibrary
Error loading library intermediate output follows.
The actual error is at the end of this output.
*********
Unescaped left brace in regex is deprecated here (and will be fatal in Perl 5.30), passed through in regex; marked by <-- HERE in m/struct([^;,{(]*){ <-- HERE (.*?)\}([^;])*;/ at D:\Program Files\MATLAB\R2019a\toolbox\matlab\general\private\prototypes.pl line 912.
Warning no reference to header 'MathLibrary' added with addheader was found in source.
*********
Error using loadlibrary
Building MathLibrary_thunk_pcwin64 failed. Compiler output is:
cl -I"D:\Program Files\MATLAB\R2019a\extern\include" /Zp8 /W3
/nologo -I"D:\Program Files\MATLAB\R2019a\bin"
-I"C:\Users\user\source\repos\MathLibrary\Release"
"MathLibrary_thunk_pcwin64.c" -LD
-Fe"MathLibrary_thunk_pcwin64.dll"
MathLibrary_thunk_pcwin64.c
C:\Users\miche\source\repos\MathLibrary\Release\MathLibrary.lib(1):
error C2059: syntax error: '!'
C:\Users\miche\source\repos\MathLibrary\Release\MathLibrary.lib(2):
error C2018: character '0x60' unknown
and then it just goes on like this, with a lot of character errors.
What is wrong with my code? How do I solve this?
I download boost 1.55, extract it, and run the following:
> bootstrap.bat
cl : Command line warning D9035 : option 'GZ' has been deprecated and will be removed in a future release
cl : Command line warning D9036 : use 'RTC1' instead of 'GZ'
cl : Command line warning D9002 : ignoring unknown option '/MLd'
Bootstrapping is done. To build, run:
...
> b2 --build-type=complete --build-dir=build --toolset=msvc-14.0 stage
However, I get the following error:
error: msvc initialization: parameter 'version' inconsistent
error: no value was specified in earlier initialization
error: an explicit value is specified now
Following the same steps with MSVC 2012, I didn't get that error.
If I do --toolset=msvc instead, then it works. However, the generated files have -vc instead of -vc140, which is what I'd like.
How do I specify the toolset explicitly? Where was it "specified in earlier initialization"?
(The reason I want to do this is I am getting a weird linker error later - saying it's looking for some -vc120 boost library... and I have no idea why. I'm trying to eliminate all the possibilities.)
The previously specified version is in project-config.jam:
using msvc ;
Change it to:
using msvc : 14.0 ;
I'm having a problem compiling mysql connectors C++ with mingw, as posted in the official website, you should run cmake to configure the source, then run a mingw32-make... the cmake needs to have the boost library installed, so i got it and compiled it (it says many updated, 40 targets skipped and failed to update 24).
After that tried to run cmake on mysql connector source, it output no errors and work just fine, when trying to do the final step mingw32-make, it gives lots of errors, many of then are redefinitions... the log is below. Please help me i really need it.
C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\bin>mingw32-make
[ 0%] Building CXX object driver/CMakeFiles/mysqlcppconn.dir/mysql_art_resultset.cpp.obj
C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\mysql_art_resultset.cpp:1:0: warning: -fPIC
ignored for target (all code is position independent) [enabled by default]
In file included from C:/MySQL/MySQL_Server_5.6/include/my_global.h:72:0,
from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\nativeapi/mysql_private_iface.h:57,
from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\mysql_util.h:30,
from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\mysql_art_resultset.cpp:31:
C:/MySQL/MySQL_Server_5.6/include/my_config.h:509:0: warning: "isnan" redefined [enabled by default]
In file included from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\mysql_art_resultset.cpp:28:0:
c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/include/math.h:480:0: note: this is the location of the previous definition
In file included from C:/MySQL/MySQL_Server_5.6/include/my_global.h:72:0,
from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\nativeapi/mysql_private_iface.h:57,
from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\mysql_util.h:30,
from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\mysql_art_resultset.cpp:31:
C:/MySQL/MySQL_Server_5.6/include/my_config.h:517:0: warning: "strtok_r" redefined [enabled by default]
In file included from c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/i686-w64-mingw32/bits/gthr-default.h:41:0,
from c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/i686-w64-mingw32/bits/gthr.h:150,
from c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/ext/atomicity.h:34,
from c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/bits/ios_base.h:41,
from c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/ios:43,
from c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/istream:40,
from c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/sstream:39,
from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\mysql_art_resultset.cpp:27:
c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/include/pthread.h:460:0: note: this is the location of the previous definition
In file included from C:/MySQL/MySQL_Server_5.6/include/my_global.h:72:0,
from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\nativeapi/mysql_private_iface.h:57,
from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\mysql_util.h:30,
from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\mysql_art_resultset.cpp:31:
C:/MySQL/MySQL_Server_5.6/include/my_config.h:527:0: warning: "NOMINMAX" redefined [enabled by default]
In file included from c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/i686-w64-mingw32/bits/c++config.h:414:0,
from c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/iosfwd:40,
from c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/ios:39,
from c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/istream:40,
from c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/sstream:39,
from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\mysql_art_resultset.cpp:27:
c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/i686-w64-mingw32/bits/os_defines.h:46:0: note: this is the location of the previous definition
In file included from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\mysql_util.h:30:0,
from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\mysql_art_resultset.cpp:31:
C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\nativeapi/mysql_private_iface.h:81:0: warning: ignoring #pragma warning [-Wunknown-pragmas]
In file included from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\mysql_art_resultset.c
pp:36:0:
C:/Users/Hugo/Downloads/mysql-connector-c++-1.1.2/cppconn/exception.h:48:0: warning: ignoring #pragma warning [-Wunknown-pragmas]
C:/Users/Hugo/Downloads/mysql-connector-c++-1.1.2/cppconn/exception.h:52:0: warning: ignoring #pragma warning [-Wunknown-pragmas]
C:/Users/Hugo/Downloads/mysql-connector-c++-1.1.2/cppconn/exception.h:53:0: warning: ignoring #pragma warning [-Wunknown-pragmas]
C:/Users/Hugo/Downloads/mysql-connector-c++-1.1.2/cppconn/exception.h:58:0: warning: ignoring #pragma warning [-Wunknown-pragmas]
C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\mysql_art_resultset.cpp:162:1: error: invalid suffix "ui64" on integer constant
C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\mysql_art_resultset.cpp:162:1: error: invalid suffix "ui64" on integer constant
In file included from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\nativeapi/mysql_private_iface.h:57:0,
from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\mysql_util.h:30,
from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\mysql_art_resultset.cpp:31:
C:/MySQL/MySQL_Server_5.6/include/my_global.h: In function 'double rint(double)':
C:/MySQL/MySQL_Server_5.6/include/my_global.h:1160:35: error: 'double rint(double)' was declared 'extern' and later 'static' [-fpermissive]
In file included from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\mysql_art_resultset.cpp:28:0:
c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/include/math.h:783:23: error: previous declaration of 'double rint(double)' [-fpermissive]
In file included from D:/boost_1_53_0/boost/assert.hpp:81:0,
from D:/boost_1_53_0/boost/smart_ptr/shared_ptr.hpp:29,
from D:/boost_1_53_0/boost/shared_ptr.hpp:17,
from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\mysql_util.h:33,
from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\mysql_art_resultset.cpp:31:
c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/cstdlib: At global scope:
c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/cstdlib:196:11: error: '::strtoll' has not been declared
c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/cstdlib:197:11: error: '::strtoull' has not been declared
c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/cstdlib:219:22: error: '__gnu_cxx::strtoll' has not been declared
c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/cstdlib:220:22: error: '__gnu_cxx::strtoull' has not been declared
driver\CMakeFiles\mysqlcppconn.dir\build.make:57: recipe for target 'driver/CMakeFiles/mysqlcppconn.dir/mysql_art_resultset.cpp.obj' failed
mingw32-make[2]: *** [driver/CMakeFiles/mysqlcppconn.dir/mysql_art_resultset.cpp.obj] Error 1
CMakeFiles\Makefile2:94: recipe for target 'driver/CMakeFiles/mysqlcppconn.dir/all' failed
mingw32-make[1]: *** [driver/CMakeFiles/mysqlcppconn.dir/all] Error 2
makefile:135: recipe for target 'all' failed
mingw32-make: *** [all] Error 2
The mysql connector c++ source code is garbage, unfortunately.
It redefines functions that are defined in the standard library and then includes the standard library, or depends on non-standard functions that are not included in every implementation.
Since the standard library does not check to see if its functions and structs have already been defined, you end up with multiple definition errors all over the place.
Also, the problem is made worse for you in that mysql connector has not been ported for mingw. To compile on windows you are required to use visual studio.
It get's better. They only support visual studio 8 and 9.
If you follow these instructions exactly,
http://dev.mysql.com/doc/connector-cpp/en/connector-cpp-installation-source-windows.html
then you might be able to get it to work, but you must not deviate from any version numbers. Use an old version of cmake, an old version of visual studio. They have not tested nor do they care about compatibility with any modern versions of build tools.
While doing programming in Code::Blocks it compiles well for C but not for C++. Even for a "Hello World" program:
#include <iostream>
using namespace std;
int main()
{
cout << "Hello world!" << endl;
return 0;
}
it gives these errors:
-------------- Build: Debug in project ---------------
Compiling: main.cpp
Linking console executable: bin\Debug\project.exe
C:\Program Files (x86)\CodeBlocks\MinGW\lib/libstdc++.a(eh_throw.o):eh_throw.cc:(.text+0x7b): undefined reference to `__w32_sharedptr_unexpected'
C:\Program Files (x86)\CodeBlocks\MinGW\lib/libstdc++.a(eh_throw.o):eh_throw.cc:(.text+0x8c): undefined reference to `__w32_sharedptr_terminate'
C:\Program Files (x86)\CodeBlocks\MinGW\lib/libstdc++.a(eh_globals.o):eh_globals.cc:(.text+0x4e): undefined reference to `__w32_sharedptr'
C:\Program Files (x86)\CodeBlocks\MinGW\lib/libstdc++.a(eh_globals.o):eh_globals.cc:(.text+0xb9): undefined reference to `__w32_sharedptr'
C:\Program Files (x86)\CodeBlocks\MinGW\lib/libstdc++.a(eh_globals.o):eh_globals.cc:(.text+0x179): undefined reference to `__w32_sharedptr'
C:\Program Files (x86)\CodeBlocks\MinGW\lib/libstdc++.a(eh_globals.o):eh_globals.cc:(.text+0x186): undefined reference to `__w32_sharedptr'
C:\Program Files (x86)\CodeBlocks\MinGW\lib/libstdc++.a(eh_globals.o):eh_globals.cc:(.text+0x1e3): undefined reference to `__w32_sharedptr'
C:\Program Files (x86)\CodeBlocks\MinGW\lib/libstdc++.a(eh_globals.o):eh_globals.cc:(.text+0x1ef): more undefined references to `__w32_sharedptr' follow
C:\Program Files (x86)\CodeBlocks\MinGW\lib/libstdc++.a(eh_terminate.o):eh_terminate.cc:(.text+0x67): undefined reference to `__w32_sharedptr_terminate'
C:\Program Files (x86)\CodeBlocks\MinGW\lib/libstdc++.a(eh_terminate.o):eh_terminate.cc:(.text+0x97): undefined reference to `__w32_sharedptr_unexpected'
C:\Program Files (x86)\CodeBlocks\MinGW\lib/libstdc++.a(eh_terminate.o):eh_terminate.cc:(.text+0xb3): undefined reference to `__w32_sharedptr_terminate'
C:\Program Files (x86)\CodeBlocks\MinGW\lib/libstdc++.a(eh_terminate.o):eh_terminate.cc:(.text+0xd3): undefined reference to `__w32_sharedptr_unexpected'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 1 seconds)
12 errors, 0 warnings
The errors you're getting indicate that the linker is having trouble locating __w32_sharedptr which is probably a dependency libstdc++ needs to work.
Normally the standard library and any dependencies it needs are linked in automatically when you build your project. However, as trojanfoe's comment indicates this is only true if you're compiling with g++. If you're building C++ code with gcc, the C++ standard library won't get included automatically since the gcc driver thinks it's compiling C code.
To verify what's actually happening in your codeblocks setup go to Settings->Compiler and Debugger->Global compiler settings(on the left)->under Toolchain executables tab. You should see something similar to this:
If your setup looks right but still refuses to build properly, enable full compiler logging and see what commands are actually being invoked by the IDE. You can find this under Global compiler settings->Other settings tab-> Compiler Log = Full command line. Note you might have to scroll a bit to the right to find the tab.
With full logging enabled, rebuild your project again and update your question with the commands used.
This is approximately what you should see in the log window when you rebuilt with the above options turned on: