List:MySQL++« Previous MessageNext Message »
From:Thomas Volckhausen Date:July 13 2010 6:47pm
Subject:Mysql++ in Visual Studio 2010, Need To Rebuild MySQL Server?
View as plain text  
Hello mysql++ experts,

I have a Visual Studio Solution using mysql++ 2.3.2 and MySQL Server 5.1 which works fine
in Visual Studio 2008.

When I convert the solution to Visual Studio 2010, I get LNK1169/LNK2005 errors from
double defines like the following (from another project later in the build, mysql++
builds OK),

"Error 6 error LNK2005: "public: void __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >::reserve(unsigned
int)"
(?reserve@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXI@Z<mailto:?reserve@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXI@Z>)
already defined in Utility.obj
C:\Projects\ResWeightVS2010DOE2ComBranch\DEER2008Store\mysqlpp.lib(mysqlpp.dll)"
"

In general when using .lib files in Visual Studio I try to have all projects and their
dependencies built with the same version of Visual Studio.
But the mysql++ project uses the C:\Program Files\MySQL\MySQL Server
5.1\Embedded\DLL\release\libmysqld.lib as a linker input. 
I don't explicitly use basic_string anywhere, but there are lots of #include
<string> in my files.


My MySQL Server 5.1 installation is from the MySql AB windows msi file, so I don't know
what compiler it was built from, but I am pretty sure that it was not Visual Studio 2010.
Googling around, mixing versions of the Standard C++ Libraries is considered a very bad
idea.

So my question is, should I rebuild MySQL Server 5.1 from source in Visual Studio 2010
when converting mysql++ and related projects to Visual Studio 2010??
Or is the libmysqld.lib library generic enough that any Visual Studio version can safely
link to it??

I know that linking across compilers can cause issues because of different naming
conventions, etc., but my knowledge of the internals of the linking process is not
adequate to answer the questions above. So I am hoping someone on this list either knows
the answers or can help me answer them myself.

Thanks for your help,
Tom
Thread
Mysql++ in Visual Studio 2010, Need To Rebuild MySQL Server?Thomas Volckhausen13 Jul
  • Re: Mysql++ in Visual Studio 2010, Need To Rebuild MySQL Server?Warren Young13 Jul