Hi,
thank You very much for Your quick reply!
Please find some comments on Your answers inline.
2008/4/22, Warren Young <mysqlpp@stripped>:
> There may, however, be a legal limitation here due to MySQL++'s LGPL
> license: if you distribute binaries statically linked to MySQL++, you also
> have to offer enough of the source code that people can relink your program
> to a new version of MySQL++. The LGPL lets you avoid this if you use
> dynamic linkage, which is why it's the default build option in the
> distribution for all platforms.
You mean, that building MySQL++ with /MT generates a static library?
This is not the case, as the mysqlpp[_d].dll in that case still is
generated (and needed by the executable). I think the determination
whether to build a dll or lib takes place in the "common" tab of the
project properties where you need to select "static lib" as
"configuration type"...
I do not want to link statically due to LGPL.
> However, beware that the underlying MySQL C API library uses the even
> stricter GPL by default, unless you arrange for a commercial license for
> MySQL on the systems you run your program on.
Thank You for this hin, but I know this, and we already own a
commercial MySQL license (which I also wrote in my first mail).
> > Strangely, if I compile excommon and simple2 as "Multithreaded (/MT)"
> > it also does not link, although all should fit together in that case.
> >
>
> I'm not entirely sure what it is you are doing, but the rule is simple: all
> modules in a single program have to be compiled with the same settings. You
> can't mix /MD or /MT flags among modules that get linked together into a
> single EXE. This is the way VC++ works.
That's what I also thought before I tried the following:
* open the mysql++.sln workspace from the vc2003 directory in my VC7.1;
* compile (debug build) without changing settings;
* works w/o linker errors; can execute binaries like simple1.exe etc.;
* change Code Generation for "mysqlpp" project from "Multithreaded
Debug DLL (/MDd)" to "Multithreaded Debug (/MTd)", rebuild all; (note
that simple1 project is still configured as /MDd so I mixed the
flags!)
* works w/o linker errors, can execute binaries like simple1.exe w/o problems;
* change Code Generation for "excommon" to /MTd;
* rebuilding "excommon" results in 3 linker warnings, although mysqlpp
and excommon have now the same /MTd flag: they look like
---8<-------
cmdline.obj : warning LNK4006: '"public: class
std::basic_ostream<char,struct std::char_traits<char> > & __thiscall
std::basic_ostream<char,struct std::char_traits<char>
>::operator<<(int)"
(??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@H@Z)'
bereits in 'mysqlpp_d.lib(mysqlpp_d.dll)' definiert; zweite Definition
wird ignoriert
--->8-------
(have a German VS, message in English means "already defined in
mysqlpp_d.dll, ignoring 2nd definition")
* change Code Generation for "simple1" to /MTd;
* rebuilding "simple1" results in 5 linker errors:
---8<-------
mysqlpp_excommon.lib(mysqlpp_d.dll) : error LNK2005: "public: class
std::basic_ostream<char,struct std::char_traits<char> > & __thiscall
std::basic_ostream<char,struct std::char_traits<char> >::flush(void)"
(?flush@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@XZ)
bereits in mysqlpp_excommon.lib(cmdline.obj) definiert
mysqlpp_excommon.lib(mysqlpp_d.dll) : error LNK2005: "public: class
std::basic_ostream<char,struct std::char_traits<char> > & __thiscall
std::basic_ostream<char,struct std::char_traits<char> >::put(char)"
(?put@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@D@Z)
bereits in mysqlpp_excommon.lib(cmdline.obj) definiert
libcpmtd.lib(cerr.obj) : error LNK2005: "public: void __thiscall
std::basic_ios<char,struct std::char_traits<char>
>::setstate(int,bool)"
(?setstate@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEXH_N@Z) bereits
in mysqlpp_excommon.lib(mysqlpp_d.dll) definiert
libcpmtd.lib(cout.obj) : error LNK2005: "public: void __thiscall
std::basic_ios<char,struct std::char_traits<char>
>::setstate(int,bool)"
(?setstate@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEXH_N@Z) bereits
in mysqlpp_excommon.lib(mysqlpp_d.dll) definiert
E:\develop\LEOS_SRV\_new\mysql++-3.0.2\vc2003\Debug\simple1.exe :
fatal error LNK1169: Ein oder mehrere mehrfach definierte Symbole
gefunden
--->8-------
(last one meaning "one or more multiple defined symbols found")
I have configured all projects with the same code generation option
(/MTd) and it does *not* work. Any ideas on that?
Thanks for your help in advance.
Best regards,
-oli-
(O. Baum)

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.