Skip navigation links

MySQL Forums :: Connector/C++ :: Xcode C++ connector problem


Advanced Search

Xcode C++ connector problem
Posted by: Carl Tsue ()
Date: May 27, 2010 01:12PM

I'm new to mysql and was looking to learn/play around with c++ and mysql. I'm running
-mysql-5.1.45-osx 10.5-x86_64
- The include files are located in usr/local/mysql-5.1.45-osx10.5-x86-64
-mysql-connector-c++-10.5-osx10.5-x86-64bit
- The include and lib files are located in usr/local/mysql/include and usr/local/mysql/lib

-Mac OSX 10.6 (snow leopard)
-Xcode 3


I’ve been researching this issue for a few days and found others with the same problem but none of their solutions resolved mine and I can’t seem to figure out why.

I do the following.
1) Create new Carbon C++ Application
2) Add all the header files from usr/local/mysql/include and usr/local/mysql/include/cppconn into the project
3) Add all the libraries from usr/local/mysql/lib to target/testproject/Link Binary with Libraries
4) Modified the project settings by highlighting the project then clicking info as follows
- Added to Search Paths “Header Search Paths”
* usr/local/mysql-5.1.45-osx10.5-x86-64/include/**
* usr/local/mysql/include/**
- Added to Search Paths “Library Search Paths”
* usr/local/mysql-5.1.45-osx10.5-x86-64/lib/**
* usr/local/mysql/lib/**
-Under linking “Other Linker Flags” I’ve done a number of things here to be honest I’m not sure really what to do here.
* -lmysqlclient –lm –lz

My code looks as follows (I’ve omitted the default code that xcode adds when you create a carbon c++ application):

#include <Carbon/Carbon.h>
#include <TApplication.h>
#include “TWindow.h”
#include <sstream>
#include <memory >
#include <string>
#include <stdexcept>


#include <driver.h>
#include <connection.h>
#include <statement.h>
#include <prepared_statement.h>
#include <resultset.h>
#include <metadata.h>
#include <resultset_metadata.h>
#include <exception.h>
#include <warning.h>

Using namespace std;
Using namespace sql;


int main(int argc, const char *argv[]) {

Driver *driver;
try {
driver = get_driver_instance();
}
catch(SQLException &e){
cout<<”SQL Exception: ”<<e.what();
}
catch(runtime_error &e){
cout<<”Runtime Exception: ”<<e.what();
}
return 0;
}


The error message I receive when I build and run is below. So I was wondering if anyone who familiar with this issue or has successfully connected to a mysql database via c++ and xcode could help me out tell me what I’m doing wrong. Thanks in advance.

“_get_driver_instance”,referenced from:
_main in main.o
Symbol(s) not found
Collect2:Id returned 1 exit status

Options: ReplyQuote


Subject Views Written By Posted
Xcode C++ connector problem 4704 Carl Tsue 05/27/2010 01:12PM
Re: Xcode C++ connector problem 1730 Ulf Wendel 07/19/2010 11:16AM
Re: Xcode C++ connector problem 1334 Casey Mongoven 10/15/2010 11:56AM
Xcode C++ connector problem 1559 Carl Tsue 05/27/2010 01:56PM


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.