Click here to Skip to main content
15,881,173 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
g++
g++ main.cpp -I"C:/Program Files/MySQL/MySQL Connector C++ 1.0.5/include"  -L"C:/Program Files/MySQL/MySQL Connector C++ 1.0.5/lib/debug" -lmysqlcppconn

main.cpp
#include <iostream>
#include "mysql_connection.h"
#include "cppconn/driver.h"
#include "cppconn/exception.h"
#include "cppconn/resultset.h"
#include "cppconn/statement.h"
#include "cppconn/prepared_statement.h"
using namespace std;
int main(){
	sql::Driver *driver;
	sql::Connection *con;
	driver=get_driver_instance();
	con=driver->connect("tcp://localhost","root","root");
	con->setSchema("test");
	sql::Statement * stmt;
	stmt=con->createStatement();
	sql::ResultSet * res;
	res=stmt->executeQuery("select * from students");
	while(res->next()){
		std::cout<<"label 	:	"<<res->getString("message")<<endl;
	}
	delete res;
	delete stmt;
	delete con;
	return 0;
}


When compiling the above main.cpp file with the above g++ command it gives bunch of error

C:/Program Files/MySQL/MySQL Connector C++ 1.0.5/include/cppconn/config.h:60:18: error: conflicting declaration 'typedef char int8_t'
 typedef __int8   int8_t;
                  ^~~~~~
C:/Program Files/MySQL/MySQL Connector C++ 1.0.5/include/cppconn/config.h:75:19: error: conflicting declaration 'typedef long int int32_t'
 typedef __int32   int32_t;
                   ^~~~~~~
C:/Program Files/MySQL/MySQL Connector C++ 1.0.5/include/cppconn/config.h:79:26: error: conflicting declaration 'typedef long unsigned int uint32_t'
 typedef unsigned __int32 uint32_t;
                          ^~~~~~~~


What I have tried:

Hot to fix this conflicting error msg this is generated inside the config.h file?

Thanks in advance.
Posted
Updated 3-Feb-21 20:11pm

1 solution

Looks a MySQL bug: MySQL Bugs: #61878: error: conflicting declaration 'typedef char int***_t'[^].
You my try to get a more updated version of it (hoping they've fixed the bug) or manually redefine one typedef in order to overcome the problem.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900