Quantcast
Channel: MySQL Forums - Connector/C++
Viewing all articles
Browse latest Browse all 527

Using the C++ Connector on Windows 7 with MinGW (no replies)

$
0
0
Dear all,

This topic is slowly driving me crazy.

Intention
---------
I have a dedicated MySQL Server up and running. I can connect to it from remote machines, it's configured properly. Now I want to create a C++ application which feeds data to the database. Either way, C or C++ would be fine.

Situation
---------
The system is Windows 7. I develop with Eclipse CDT Helios, use the MinGW C++ toolchain with g++ 4.4.0. The application uses MSYS Makefiles.

1st Attempt
-----------
Since I code with C++, I downloaded the MySQL C++ connector 1.1.0 (mysql-connector-c++-noinstall-1.1.0-win32). I tried to compile the example 1 as mentioned in section 21.5.5.5.: "MySQL Connector/C++ Complete Example 1" (as seen in http://dev.mysql.com/doc/refman/5.1/en/connector-cpp-examples-complete-example-1.html) with

g++ -c -I mysql/include -Iboost-1_42/include example1.cpp

The compiler complained: "mysql/include/cppconn/config.h:60: error: conflicting declaration 'typedef char int8_t' [...] stdint.h:27: error: 'int8_t' has a previous declaration as 'typedef signed char int8_t'" so I patched mysql/include/cppconn/config.h and removed all the defines like HAVE_MS_INT8. Compiling worked and linking with

g++ -Lmysql/lib -Lboost-1_42/lib example1.o -o example1 -lmysqlcppconn

worked as well. I copied mysqlcppconn.dll to the current directory. Starting the application I get a APPCRASH problem event, telling me that my exe failed in module mysqlcppconn.dll, ExceptionCode c0000005, AdditionalInformation 1+3 0a9e, Additional Information 2+4 0a9e372d3b4ad19135b953a78882e789. The point of crash is the line

con = driver->connect("tcp://192.168.1.10", "MyAccount", "Password");

which is exactly the host, uid and password I use when I connect to the server with the MySQL-Admin GUI tool. 'driver' was not NULL. The db server is a Windows Server 2008 machine. I have a secondary MySQL db running on an Ubuntu Linux host, but got the same result (not even an entry in the mysql logfile in /var/log).

Any suggestion? My assumption is that the DLL simply doesn't work with my MinGW application, even if it compiles/links fine. Other attempts with work-arounds are posted in another thread.

Viewing all articles
Browse latest Browse all 527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>