On Apr 17, 2008, at 3:45 AM, Fritiof Hedman wrote:
>
> I'm trying to compile resetdb.cpp, using Code::blocks 8.02, MinGW (The
> one that was coming with CB) but I get a lot of errors like:
>
> C:\C++\mysql++-3.0.2\examples\resetdb.o:resetdb.cpp:(.text+0x273)||
> undefined
> reference to `__imp___ZN7mysqlpp19get_library_versionEv'|
The MySQL++ examples weren't designed to be compiled independently
from the rest of MySQL++. With MinGW, it's best to build the library
and examples using the Makefile.mingw that comes with the library,
using the instructions in README-MinGW.txt.
If you've done that and are just trying to build something
independent, the secret is that there are two other modules in the
examples directory that you need to build and link with resetdb.cpp:
cmdline.cpp and printdata.cpp.
You may want to start from scratch, rather than modify one of the
examples to make it suit your purpose, though.
> reference to `mysqlpp::Connection::connect(char const*, char const*,
> char const*, char const*, unsigned int)'|
...and this message means you aren't linking to the MySQL++ library.
You have to link to both the MySQL C API library and the MySQL++
library.
This is all spelled out in the FAQ on the main MySQL++ page, in the
READMEs, and in the user manual.