c++ and mysql, cant seem to get it working.
Posted by: datanot forsale
Date: October 13, 2011 03:16AM

I'm fairly new to c++, and i'm completely new to mysql

OK so i'm going to document everything, I've tryed in the last 3 days to get MySQL to work with visual c++ 2010, so far with very little success.

The tutorials are for installing on all platforms, and I'm using Windows Vista SP2, the tutorials aren't very clear to me which installation they are on about, and talk about installing from binary then jumping to source code of the connector, which leaves me sat here saying 'WTF is it on about!?'

could rant about what i do and don't understand about this for hours but anyway.

OK my system is Windows Vista SP2 32bit x86, i think that's correct
I installed the MySQL 5.5 Server 5.5.6 i think it was (the .msi file)
I also installed WorkBench 5.2, to do this i had to set MySQL to a windows server, which i did with a line or 2 through command promt (it may have ****ed it up but i'm really not sure) i will search the tutorial and post the command promt commands that i put in.

The workbench seems to work (not like on the tutorial tho) when i set up the tutorial tho it never asks me for my operating system and i have to manually include the my.ini file when i state what mysql version i will be using. Not sure if thats a problem on its own or not, if anyones interested in that i will post some screenshots of it.


OK so next... the actual problem, I have installed MySQL Connector c++ 1.0.5 and i also have Connector 1.1.0 I am trying to use it with Visual C++ 2010, (havnt attempted with devc++ yet) so in my VC++ Directories i have put it the following:

Include Directories:
C:\Program Files\MySQL\Connector C++ 1.1.0\include
one of the versions also asked for a boost so i included the files from boost 1.4.47
C:\Users\Carl\Desktop\Programming stuff\boost_1_47_0

Library Directories:
C:\Program Files\MySQL\Connector C++ 1.1.0\lib
C:\Users\Carl\Desktop\Programming stuff\boost_1_47_0\libs

in Linker -> General
Additional Dependencies:
mysqlcppconn.lib
(i tryed a few others but just kept getting told they were nowhere to be found)

OK so, so far that should all be right from what i can figure, i don't do a whole lot of external linking in my travels but, i think thats right.

I'm guessing I've done something wrong in one of the installations or it is a compatibility problem.

Anyway see what you think, by now I'm hoping you can probably see what I've done wrong but if not here is the code that i try to compile with VC++ 2010

EDIT: Just been trying with other tutorial scripts and its the same error every time, still no fix but trying to find out if its the string file in VC Include.

/* Standard C++ includes */
#include <stdlib.h>
#include <iostream>
#include <string>

#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()
{
return 0;
}


Here is the long list of errors:

1>------ Build started: Project: TEST, Configuration: Debug Win32 ------
1> FDGDFS.cpp
1>c:\program files\microsoft visual studio 10.0\vc\include\string(16): error C2143: syntax error : missing ';' before ''template<''
1>c:\program files\microsoft visual studio 10.0\vc\include\string(16): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft visual studio 10.0\vc\include\string(19): error C2143: syntax error : missing ';' before '<'
1>c:\program files\microsoft visual studio 10.0\vc\include\string(19): error C2433: 'basic_string' : 'inline' not permitted on data declarations
1>c:\program files\microsoft visual studio 10.0\vc\include\string(19): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft visual studio 10.0\vc\include\string(19): error C2988: unrecognizable template declaration/definition
1>c:\program files\microsoft visual studio 10.0\vc\include\string(19): error C2059: syntax error : '<'
1>c:\program files\microsoft visual studio 10.0\vc\include\string(36): error C2143: syntax error : missing ';' before '{'
1>c:\program files\microsoft visual studio 10.0\vc\include\string(36): error C2447: '{' : missing function header (old-style formal list?)
1>c:\program files\microsoft visual studio 10.0\vc\include\string(47): error C2143: syntax error : missing ';' before '<'
1>c:\program files\microsoft visual studio 10.0\vc\include\string(47): error C2433: 'basic_string' : 'inline' not permitted on data declarations
1>c:\program files\microsoft visual studio 10.0\vc\include\string(47): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft visual studio 10.0\vc\include\string(47): error C2086: 'int basic_string' : redefinition
1> c:\program files\microsoft visual studio 10.0\vc\include\string(19) : see declaration of 'basic_string'
1>c:\program files\microsoft visual studio 10.0\vc\include\string(47): error C2988: unrecognizable template declaration/definition
1>c:\program files\microsoft visual studio 10.0\vc\include\string(47): error C2059: syntax error : '<'
1>c:\program files\microsoft visual studio 10.0\vc\include\string(64): error C2143: syntax error : missing ';' before '{'
1>c:\program files\microsoft visual studio 10.0\vc\include\string(64): error C2447: '{' : missing function header (old-style formal list?)
1>c:\program files\microsoft visual studio 10.0\vc\include\string(75): error C2143: syntax error : missing ';' before '<'
1>c:\program files\microsoft visual studio 10.0\vc\include\string(75): error C2433: 'basic_string' : 'inline' not permitted on data declarations
1>c:\program files\microsoft visual studio 10.0\vc\include\string(75): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft visual studio 10.0\vc\include\string(75): error C2086: 'int basic_string' : redefinition
1> c:\program files\microsoft visual studio 10.0\vc\include\string(19) : see declaration of 'basic_string'
1>c:\program files\microsoft visual studio 10.0\vc\include\string(75): error C2988: unrecognizable template declaration/definition
1>c:\program files\microsoft visual studio 10.0\vc\include\string(75): error C2059: syntax error : '<'
1>c:\program files\microsoft visual studio 10.0\vc\include\string(92): error C2143: syntax error : missing ';' before '{'
1>c:\program files\microsoft visual studio 10.0\vc\include\string(92): error C2447: '{' : missing function header (old-style formal list?)
1>c:\program files\microsoft visual studio 10.0\vc\include\string(99): error C2143: syntax error : missing ';' before '<'
1>c:\program files\microsoft visual studio 10.0\vc\include\string(99): error C2433: 'basic_string' : 'inline' not permitted on data declarations
1>c:\program files\microsoft visual studio 10.0\vc\include\string(99): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft visual studio 10.0\vc\include\string(99): error C2086: 'int basic_string' : redefinition
1> c:\program files\microsoft visual studio 10.0\vc\include\string(19) : see declaration of 'basic_string'
1>c:\program files\microsoft visual studio 10.0\vc\include\string(99): error C2988: unrecognizable template declaration/definition
1>c:\program files\microsoft visual studio 10.0\vc\include\string(99): error C2059: syntax error : '<'
1>c:\program files\microsoft visual studio 10.0\vc\include\string(112): error C2143: syntax error : missing ';' before '{'
1>c:\program files\microsoft visual studio 10.0\vc\include\string(112): error C2447: '{' : missing function header (old-style formal list?)
1>c:\program files\microsoft visual studio 10.0\vc\include\string(123): error C2143: syntax error : missing ';' before '<'
1>c:\program files\microsoft visual studio 10.0\vc\include\string(123): error C2433: 'basic_string' : 'inline' not permitted on data declarations
1>c:\program files\microsoft visual studio 10.0\vc\include\string(123): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft visual studio 10.0\vc\include\string(123): error C2086: 'int basic_string' : redefinition
1> c:\program files\microsoft visual studio 10.0\vc\include\string(19) : see declaration of 'basic_string'
1>c:\program files\microsoft visual studio 10.0\vc\include\string(123): error C2988: unrecognizable template declaration/definition
1>c:\program files\microsoft visual studio 10.0\vc\include\string(123): error C2059: syntax error : '<'
1>c:\program files\microsoft visual studio 10.0\vc\include\string(136): error C2143: syntax error : missing ';' before '{'
1>c:\program files\microsoft visual studio 10.0\vc\include\string(136): error C2447: '{' : missing function header (old-style formal list?)
1>c:\program files\microsoft visual studio 10.0\vc\include\string(143): error C2143: syntax error : missing ';' before '<'
1>c:\program files\microsoft visual studio 10.0\vc\include\string(143): error C2433: 'basic_string' : 'inline' not permitted on data declarations
1>c:\program files\microsoft visual studio 10.0\vc\include\string(143): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft visual studio 10.0\vc\include\string(143): error C2086: 'int basic_string' : redefinition
1> c:\program files\microsoft visual studio 10.0\vc\include\string(19) : see declaration of 'basic_string'
1>c:\program files\microsoft visual studio 10.0\vc\include\string(143): error C2988: unrecognizable template declaration/definition
1>c:\program files\microsoft visual studio 10.0\vc\include\string(143): error C2059: syntax error : '<'
1>c:\program files\microsoft visual studio 10.0\vc\include\string(156): error C2143: syntax error : missing ';' before '{'
1>c:\program files\microsoft visual studio 10.0\vc\include\string(156): error C2447: '{' : missing function header (old-style formal list?)
1>c:\program files\microsoft visual studio 10.0\vc\include\string(164): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft visual studio 10.0\vc\include\string(164): error C2143: syntax error : missing ',' before '<'
1>c:\program files\microsoft visual studio 10.0\vc\include\string(168): error C2803: 'operator ==' must have at least one formal parameter of class type
1>c:\program files\microsoft visual studio 10.0\vc\include\string(168): error C2805: binary 'operator ==' has too few parameters
1>c:\program files\microsoft visual studio 10.0\vc\include\string(175): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft visual studio 10.0\vc\include\string(175): error C2143: syntax error : missing ',' before '<'
1>c:\program files\microsoft visual studio 10.0\vc\include\string(178): error C2803: 'operator ==' must have at least one formal parameter of class type
1>c:\program files\microsoft visual studio 10.0\vc\include\string(184): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft visual studio 10.0\vc\include\string(184): error C2143: syntax error : missing ',' before '<'
1>c:\program files\microsoft visual studio 10.0\vc\include\string(188): fatal error C1903: unable to recover from previous error(s); stopping compilation
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========



Edited 1 time(s). Last edit at 10/13/2011 08:04AM by datanot forsale.

Options: ReplyQuote


Subject
Views
Written By
Posted
c++ and mysql, cant seem to get it working.
1835
October 13, 2011 03:16AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.