List:MySQL on Win32« Previous MessageNext Message »
From:Michael Widenius Date:January 13 2000 3:21pm
Subject:(WinNt) Lost without help: Link error
View as plain text  

>>>>> "R" == R Ortloff <R.Ortloff@stripped> writes:

R> Hello,
R> Sorry, I forgot to mention: I'm compiling with
R> Microsoft Visual C++ 6.0, SP3.
R> Unless the API-Application I don't use any Microsoft
R> specific methods etc. Now following the old mail:

R> I just fell in a deep depression since it just
R> won't compile my program.

R> Following thing:

R> I work under WinNt 4.0 (SP5), MySQL 3.22.30.

R> I created a library (without using any MFC) to
R> realize a Database-API. This API should be used
R> for further programs.

R> When I use that library for Win32-Console-Application,
R> everything works just fine.

R> However, now I created an MFC-Application for graphical
R> output, and it won't compile anymore.

R> My includes in the Database-API database.h are:

R> #include <windows.h>
R> #include <mysql.h>

R> [class CDatabase {...}]

R> Now I include the database.h in the MFC-Application.
R> Everything works fine.

R> For linking the MFC-Application, I included the libraries:
R> 1) overall.lib  (Just global type definitions, nothing special)
R> 2) libmysql.lib (The MySQL library)
R> 3) db.lib       (My Database-API, using overall.lib)
R> 4) appllibs.lib (Additinal functions, using overall.lib and db.lib)

R> Now I create a database object 'CDatabase Db;' and the
R> problems occur:

R> --- schnipp ---
R> Linking is running...
R> libcpd.lib(iostream.obj) : error LNK2005:
R> "public: __thiscall std::ios_base::Init::Init(void)"
R> (??0Init@ios_base@std@@QAE@XZ)
R> already defined in msvcprtd.lib(MSVCP60D.dll)


R> Especially the people who created a graphical interface
R> for managing MySQL could know about this problem.

R> I'd really appreciate any kind of help since I just
R> don't know what to do.


As this is a windows linker problem, so I don't have any definitive
answers, only some suggestions :(

Have you tried with the static mysqlclient.lib library instead of
libmysql.dll ?

Have you tried to compile your program with thread safe libraries?

Another option is to get the from:

The MyODBC 2.50.25 source distribution that includes the client code.

By using this you can compile your own client library.  If you use the
same compile options for this as for your program this should work
fine for you!


PS: We shall try to soon make a separate distribution of the latest
    client source for Win32 so that anyone can compile this easily!