Failing to compile MySQL++

View: New views
2 Messages — Rating Filter:   Alert me  

Failing to compile MySQL++

by FreezeBurnX :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello!
#include "include/mysql++.h"

#include <iostream>
#include <iomanip>
#include <string>

using namespace std;

int main(int argc, char *argv[])
{
mysqlpp::Connection con(false);
if(!connect_to_db(argc,argv,con)){
return 1;
}
return 0;
}


Gives me the error
C:\mysql++\main.cpp|12|error: `connect_to_db' was not declared in this
scope|

I have successfully compiled the dll and the examples are working, but I
don't understand what I am doing wrong. I've been searching about this for
more than 4 hours. MySQL version 5.0 is installed, I'm using gcc 3.4.5 and
mingw. IDE is Code::Blocks
Thank you!
--
-Bernardo


--
   -Bernardo

Re: Failing to compile MySQL++

by Warren Young-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On May 24, 2008, at 1:21 PM, FreezeBurnX wrote:

> if(!connect_to_db(argc,argv,con)){

This function is part of the examples in MySQL++ v2.x, not part of the  
MySQL++ library proper.  It exists only for the examples; it's not  
something to be reused.  Instead, create your connection with the  
Connection constructor, or with Connection::connect().

Or, better, switch to MySQL++ 3.x.  Among its many improvements are  
examples that don't hide this aspect of MySQL++ use within unreusable  
functions.  Look through the first parts of this section of the v3  
user manual to see the difference:

        http://tangentsoft.net/mysql++/doc/html/userman/tutorial.html

> I've been searching about this for
> more than 4 hours.

A mailing list search for "connect_to_db" pulls up 48 posts, some of  
which certainly contain this answer because it's been asked and  
answered several times before.  I believe it's covered in the Tutorial  
chapter of the v2 user manual, too.

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe:    http://lists.mysql.com/plusplus?unsub=lists@...

LightInTheBox - Buy quality products at wholesale price!