OK, I've stepped back to a simpler situation, just
trying to build a test app with a Makefile, and I get
the same error.
% cat main.cpp
#include <iostream>
#include <mysql++.h>
#include <string_util.h>
int main (int argc, char * const argv[]) {
std::cout << "Hello, World!\n";
std::string s = "34j2l4j//&*";
mysqlpp::Connection c; // no complaint here!
mysqlpp::escape_string(s);
std::cout << s;
return 0;
}
%cat Makefile
test:
g++ -g main.cpp -I/usr/local/include
-I/usr/local/mysql/include -o TEST.exe -lmysqlpp -lm
-L/usr/local/mysql/lib -lz -lmysqlclient
% make
g++ -g main.cpp -I/usr/local/include
-I/usr/local/mysql/include -o TEST.exe -lmysqlpp -lm
-L/usr/local/mysql/lib -lz -lmysqlclient
ld: Undefined symbols:
mysqlpp::escape_string(std::basic_string<char,
std::char_traits<char>, std::allocator<char> >&)
make: *** [bin] Error 1
I thought that maybe mysql_escape_string didn't wind
up in the library, but nm shows some variations there:
% nm /usr/local/lib/libmysqlpp.a | grep escape_string
U _mysql_escape_string
U _mysql_escape_string
00000b34 S _Z13escape_stringRSs.eh
000001e4 T __Z13escape_stringRSs
Help? I know there must be some g++ option to flip to
make this work. Thanks again for your feedback Ovidiu
and Warren!
--- Ovidiu Bivolaru <ovidiu@stripped> wrote:
> Btw, I've didn't used XCode to build MacOS X
> application with mysql++,
> but Makefile.
> You might want to turf off ZeroLink when building
> the application:
>
http://developer.apple.com/documentation/DeveloperTools/Conceptual/Build_System/Using_ZeroLink/Using_ZeroLink.html
>
> Regards,
> Ovidiu
>
> J Robinson wrote:
>
> >Thanks for the input, Warren and Ovidiu!
> >
> >
> >--- Warren Young <mysqlpp@stripped> wrote:
> >
> >
> >
> >>J Robinson wrote:
> >>
> >>
> >>
> >>>My program (ported from linux to OSX)
> >>>
> >>>
> >>I have yet to get a success report on OS X, so
> there
> >>may well be things
> >>that have to be done to the library to get it to
> >>work.
> >>
> >>
> >>
> >>>ZeroLink: unknown symbol '__ZTVN7mysqlpp3RowE'
> >>>
> >>>
> >>That's the only message? I would think you'd get
> a
> >>bunch of similar
> >>messages as well.
> >>
> >>
> >>
> >
> >Nope, just that one -- reproducibly. But I think
> the
> >linker may just be showing the first one.
> >
> >I forgot to mention in my last post that I'm using
> >Xcode to build and maintain the project. If need be
> I
> >can try it with straight Makefiles (ack).
> >
> >
> >
> >>>What am I doing wrong? Do I need to set
> >>>LD_LIBRARY_PATH or LDFLAGS or something? (I tried
> >>>those things but it didn't seem to make a
> >>>
> >>>
> >>difference).
> >>
> >>Do the examples compile and run?
> >>
> >>
> >
> >Yeah, they do! (And I'm using the OSX binary
> install
> >version of mysql - it does contain
> libmysqlclient.a,
> >but no libmysqlclient.dylib).
> >
> >This is on OS X 10.3.6 using MySQL 4.0.22. The
> >examples were built and tested from the command
> line,
> >but my app's being built using Xcode.
> >
> >On a related note, I found that under Xcode, I'm
> >unable to get the following code to run:
> >
> >#include <iostream>
> >#include <mysql++.h>
> >#include <string_util.h>
> >int main (int argc, char * const argv[]) {
> > // insert code here...
> > std::cout << "Hello, World!\n";
> > std::string s = "34j2l4j//&*";
> > mysqlpp::escape_string(s);
> > std::cout << s;
> > return 0;
> >}
> >
> >If I build in 'deployment' mode, I get:
> >...
> >ld: warning prebinding disabled because dependent
> >library: /usr/local/lib/libmysqlpp.3.dylib is not
> >prebound
> >ld: Undefined symbols:
> >mysqlpp::escape_string(std::basic_string<char,
> >std::char_traits<char>, std::allocator<char> >&)
> >
> >and the program won't start.
> >
> >If I build in 'development' mode, the program
> starts,
> >but at runtime I get:
> >
> >Hello, World!
> >ZeroLink: unknown symbol
> >'__ZN7mysqlpp13escape_stringERSs'
> >(hm, same symbol as above apparently)
> >
> >I'm still bangin' my head against this. The
> relevant
> >config options from Xcode are:
> >HEADER SEARCH PATHS: /usr/local/include
> >/usr/local/mysql/include
> >LIBRARY SEARCH PATHS: /usr/local/mysql/lib
> >/usr/local/lib
> >
> >OTHER LINKER FLAGS: -lmysqlpp -lmysqlclient
> >/usr/local/lib/libmysqlpp.a
> >
> >What's going wrong?
> >
> >
> >
> >__________________________________
> >Do you Yahoo!?
> >Yahoo! Mail - Helps protect you from nasty viruses.
>
> >http://promotions.yahoo.com/new_mail
> >
> >
> >
>
>
--- Ovidiu Bivolaru <ovidiu@stripped> wrote:
> 1.7.23 works fine as well. The examples are working
> too (resetd,
> simple1, etc.).
>
> Regards,
> Ovidiu
>
> Warren Young wrote:
>
> > Ovidiu Bivolaru wrote:
> >
> >> I could confirm that mysql++-1.7.19 is working
> fine on both:
> >
> >
> > Thanks for the report.
> >
> > Can you try 1.7.23 as well? All the symbols were
> moved into namespace
> > mysqlpp after 1.7.19, so your report may not be
> germane to Robinson's
> > problem.
> >
> > You don't have to install it, just get it to build
> and run resetdb.
> >
__________________________________
Do you Yahoo!?
Yahoo! Mail - now with 250MB free storage. Learn more.
http://info.mail.yahoo.com/mail_250