Quantcast
Channel: MySQL Forums - Connector/C++
Viewing all articles
Browse latest Browse all 527

Xcode Connector/C++ problem (no replies)

$
0
0
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

Viewing all articles
Browse latest Browse all 527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>