I am new to a lot of things, including mySQL++, and even mySQL, so I
probably try many stupid things, and I probably don't know much what I am
I have problems getting started using mySQL++ using Xcode under MacOS X
10.5.6 (10.5.7 soon I suppose too). I have Xcode 3.1.3.
First let me say that I was able to successfully use the native C API for
mySQL, as well as the mySQL "C++ Connector" (both from Xcode). This probably
rules out an installation problem with either mySQL or my development tools.
The problem is that the provided Xcode project file fails to build.
1- The provided mySQL++ Xcode project fails to build with the same recurring
compile-time error: config.h: no such file or directory.
This error is rather mysterious as config.h is indeed there. I was able to
work around that issue by adding "." and ".." to the header search path
2- The modified Xcode project now compiles OK, but fails at link time,
because the linker doesn't find 38 symbols, such as:
"_mysql_next_result", "_mysql_thread_id", "_mysql_shutdown",
"_mysql_errno", "_mysql_error", "_mysql_stat",
"_mysql_info", "_mysql_init", "_mysql_select_db", etc
These symbols seems to be from mySQL C API, (and indeed, they show up in a
dump by nm of libmysqlclient.a), so I tried to work around that by adding
/usr/local/mysql/lib to the library search paths and the following option to
Other link flags: -llibmysqlclient
This doesn't fix any of the errors above.
I also added libmysqlclient.a to the Xcode project manually, but that didn't
make a difference.
At this point, I don't know what I can do to fix the Xcode project. Any
3- Since I could not use the Xcode project to build mySQL++, I reverted to
the classic configure/make scheme. Everything went smoothly.
However, the standard make procedure (AFAICS), doesn't build the examples. I
am now faced with building and running at least one example. I chose
Using the provided Xcode projects fails as described above, so I created a
new Xcode project from scratch, just for that example. I modified the search
header, search library settingds, and I added the dynamic library
Also to avoid having to use command line parameters, I replaced the connect
line as :
//conn.connect(db, server, user, pass)
conn.connect("test", "localhost", "root", "")
With that in place, the example builds fine in debug mode, but crashes with
a bus error at run time on line
mysqlpp::Query query = conn.query("select item from stock");
The stack crawl is
#0 0x000fa6e1 in __gnu_cxx::__exchange_and_add
#1 0x000c4ac4 in std::locale::_Impl::_M_replace_category
#2 0x000c42fa in std::locale::operator=
#3 0x000c3f1e in std::ios_base::_M_init
#4 0x000cf207 in std::basic_ios<char, std::char_traits<char> >::init
#5 0x0006f084 in OptionalExceptions [inlined] at noexceptions.h:45
#6 0x0006f084 in mysqlpp::Query::Query at query.cpp:45
#7 0x00060808 in mysqlpp::Connection::query at connection.cpp:264
At this point, I feel stuck. What did I miss? Is that crash really a bug, or
related to the build problems I described above? I have no idea.
Does somebody have a working Xcode project with one of the samples that I
could download somewhere, so I could try to find what I missed?
Any suggestion welcome.