Nils Woetzel 写道:
> Hi everybody,
>
> we are using mysql++ for quite a long time and started with version 2.1.1.
>
>
>
> I've tried to update our project to use 2.2.0 some time ago and got a linker
> error. I was waiting to release 2.2.3, but I still get the same error.
>
>
>
> My setup:
>
> Visual studio 2005
>
> Mysql 5.0.41
>
> Mysql++ 2.2.3
>
>
>
> Mysql++ is compiling just fine.
>
>
>
> But when my project is linking with mysqlpp.lib(mysqlpp.dll), I get 34
> errors related to a std::vector<std::string>
>
> mysqlpp.lib(mysqlpp.dll) : error LNK2005: "public: __thiscall
> std::vector<class std::basic_string<char,struct
> std::char_traits<char>,class
> std::allocator<char> >,class std::allocator<class
> std::basic_string<char,struct std::char_traits<char>,class
> std::allocator<char> > > >::~vector<class
> std::basic_string<char,struct
> std::char_traits<char>,class std::allocator<char> >,class
> std::allocator<class std::basic_string<char,struct
> std::char_traits<char>,class std::allocator<char> > > >(void)"
> (??1?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V
> ?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2
> @@std@@QAE@XZ) already defined in bcl_align.obj
>
Another method for this:
just add #include <mysql++.h> to your bcl_align.cpp, which will tell the
compiler that the std::vector<std::string> is the same version in
mysqlpp.dll though your bcl_align.cpp may not need mysql function.