Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Can't use MySQL Connector to deploy a C++ program(Trying to use MySQL Connector to deploy a C++ program)
Can't use MySQL Connector to deploy a C++ program [message #1783087] Wed, 07 March 2018 14:41 Go to next message
Aitor Salgado is currently offline Aitor SalgadoFriend
Messages: 1
Registered: March 2018
Junior Member
I'm trying to use MySQL connector with Eclipse C/C++ to deploy an easy and small program where my DB returns a silly table, just to see how it works. But I always have different issues, I'll explain you what I did and the messages that Eclipse is showing me.

Could you help me? I'm pretty lost, every time I try to find a solution I end up with thousands of webs, links and references but none of the helps at all. I thought it was much easier to link Eclipse with MySQL :(

Software: (ATTACHED PICTURES)
> Eclipse C/C++ (Oxygen.2 Release (4.7.2) - Build id: 20171218-0600)
> MinGW (latest version)
> Boost 1.66.0 (C:\Program Files\boost\boost_1_66_0)
> MySQL Connector C++ 1.1.9 64b
> Windows 10 64b

Eclipse Config: (ATTACHED PICTURES)
C++ Build >> Settings >> GCC C++ Compiler >> Includes >> Include paths (-l):
"C:\Program Files\MySQL\MySQL Connector C++ 1.1.9\include"
"C:\Program Files\boost\boost_1_66_0"
C++ Build >> Settings >> MinGW C++ Linker >> Libraries >> Libraies (-l):
"C:\Program Files\MySQL\MySQL Connector C++ 1.1.9\lib\opt\mysqlcppconn-static.lib"
C++ Build >> Settings >> MinGW C++ Linker >> Libraries >> Libraies (-l):
"C:\Program Files\MySQL\MySQL Connector C++ 1.1.9\lib"


Program Code: (it's not even calling any object from MySQL libraries)
#include <iostream>
#include <mysql_connection.h>

#include <cppconn\driver.h>
#include <cppconn\exception.h>
#include <cppconn\resultset.h>
#include <cppconn\statement.h>

using namespace std;

int main() {
cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
return 0;
}

CDT Build COnsole:
15:06:43 **** Incremental Build of configuration Debug for project MySQLTests ****
Info: Internal Builder is used for build
g++ "-IC:\\Program Files\\MySQL\\MySQL Connector C++ 1.1.9\\include" "-IC:\\Program Files\\boost\\boost_1_66_0" -O0 -g3 -Wall -c -fmessage-length=0 -o "src\\MySQLTests.o" "..\\src\\MySQLTests.cpp"
In file included from C:\Program Files\MySQL\MySQL Connector C++ 1.1.9\include/cppconn/connection.h:33:0,
from C:\Program Files\MySQL\MySQL Connector C++ 1.1.9\include/mysql_connection.h:30,
from ..\src\MySQLTests.cpp:10:
C:\Program Files\MySQL\MySQL Connector C++ 1.1.9\include/cppconn/warning.h:40:0: warning: ignoring #pragma warning [-Wunknown-pragmas]
#pragma warning (disable : 4290)

In file included from C:\Program Files\MySQL\MySQL Connector C++ 1.1.9\include/cppconn/variant.h:38:0,
from C:\Program Files\MySQL\MySQL Connector C++ 1.1.9\include/cppconn/connection.h:35,
from C:\Program Files\MySQL\MySQL Connector C++ 1.1.9\include/mysql_connection.h:30,
from ..\src\MySQLTests.cpp:10:
C:\Program Files\MySQL\MySQL Connector C++ 1.1.9\include/cppconn/exception.h:48:0: warning: ignoring #pragma warning [-Wunknown-pragmas]
#pragma warning (disable : 4290)

C:\Program Files\MySQL\MySQL Connector C++ 1.1.9\include/cppconn/exception.h:52:0: warning: ignoring #pragma warning [-Wunknown-pragmas]
#pragma warning(push)

C:\Program Files\MySQL\MySQL Connector C++ 1.1.9\include/cppconn/exception.h:53:0: warning: ignoring #pragma warning [-Wunknown-pragmas]
#pragma warning(disable: 4275)

C:\Program Files\MySQL\MySQL Connector C++ 1.1.9\include/cppconn/exception.h:58:0: warning: ignoring #pragma warning [-Wunknown-pragmas]
#pragma warning(pop)

In file included from C:\Program Files\MySQL\MySQL Connector C++ 1.1.9\include/cppconn\resultset.h:30:0,
from ..\src\MySQLTests.cpp:14:
C:\Program Files\MySQL\MySQL Connector C++ 1.1.9\include/cppconn\config.h:95:19: error: conflicting declaration 'typedef long int int32_t'
typedef __int32 int32_t;
^~~~~~~
In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\stdint.h:9:0,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\cstdint:41,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\char_traits.h:420,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ios:40,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\iostream:39,
from ..\src\MySQLTests.cpp:9:
c:\mingw\include\stdint.h:62:15: note: previous declaration as 'typedef int int32_t'
typedef int int32_t;
^~~~~~~
In file included from C:\Program Files\MySQL\MySQL Connector C++ 1.1.9\include/cppconn\resultset.h:30:0,
from ..\src\MySQLTests.cpp:14:
C:\Program Files\MySQL\MySQL Connector C++ 1.1.9\include/cppconn\config.h:99:26: error: conflicting declaration 'typedef long unsigned int uint32_t'
typedef unsigned __int32 uint32_t;
^~~~~~~~
In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\stdint.h:9:0,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\cstdint:41,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\char_traits.h:420,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ios:40,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\iostream:39,
from ..\src\MySQLTests.cpp:9:
c:\mingw\include\stdint.h:63:19: note: previous declaration as 'typedef unsigned int uint32_t'
typedef unsigned uint32_t;
^~~~~~~~
In file included from C:\Program Files\MySQL\MySQL Connector C++ 1.1.9\include/cppconn\statement.h:30:0,
from ..\src\MySQLTests.cpp:15:
C:\Program Files\MySQL\MySQL Connector C++ 1.1.9\include/cppconn\config.h:95:19: error: conflicting declaration 'typedef long int int32_t'
typedef __int32 int32_t;
^~~~~~~
In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\stdint.h:9:0,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\cstdint:41,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\char_traits.h:420,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ios:40,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\iostream:39,
from ..\src\MySQLTests.cpp:9:
c:\mingw\include\stdint.h:62:15: note: previous declaration as 'typedef int int32_t'
typedef int int32_t;
^~~~~~~
In file included from C:\Program Files\MySQL\MySQL Connector C++ 1.1.9\include/cppconn\statement.h:30:0,
from ..\src\MySQLTests.cpp:15:
C:\Program Files\MySQL\MySQL Connector C++ 1.1.9\include/cppconn\config.h:99:26: error: conflicting declaration 'typedef long unsigned int uint32_t'
typedef unsigned __int32 uint32_t;
^~~~~~~~
In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\stdint.h:9:0,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\cstdint:41,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\char_traits.h:420,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ios:40,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\iostream:39,
from ..\src\MySQLTests.cpp:9:
c:\mingw\include\stdint.h:63:19: note: previous declaration as 'typedef unsigned int uint32_t'
typedef unsigned uint32_t;
^~~~~~~~

15:06:45 Build Finished (took 1s.859ms)
Re: Can't use MySQL Connector to deploy a C++ program [message #1783309 is a reply to message #1783087] Sun, 11 March 2018 15:20 Go to previous message
Joost Kraaijeveld is currently offline Joost KraaijeveldFriend
Messages: 273
Registered: July 2009
Senior Member
Hi ,

It has nothing to do with Eclipse CDT.

From the warnings (e.g. warning: ignoring #pragma warning [-Wunknown-pragmas]... "#pragma warning (disable : 4290)" and more pragma warnings ) and the error (error: conflicting declaration 'typedef long int int32_t'
typedef __int32 int32_t;) I deduce that the library you are using a MS Visual C++ library. But you are using MinGW (g++) .

In general you cannot use the C++-library compiled/linked with one compiler for the compilation/linking with another compiler. SO find a MinGW (g++) library for MySQL or use a plain C ODBC-type library.

Joost


Cheers,

Joost
Previous Topic:RE: Running Some Software Out of a Book
Next Topic:RE: Running Some Software Out of a Book
Goto Forum:
  


Current Time: Sat Apr 20 02:04:41 GMT 2024

Powered by FUDForum. Page generated in 0.03686 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top