Linkage error with Visual C++ (okay I know this is really common)

Until today I’ve used SDL the crappy way (with success) for 6 weeks.
But, now that my project start to grows, I’ve decided to clean up.

What is was, and what I’m trying to do :
The project was an OpenGL console application, single threaded, libc ignored
and #undef main before my main to skip sdlmain
Okay, this is certainly EVIL but, that worked (sound, mp3, opengl, input).

Now, what I’ve done : I’ve created a fresh WIN32 application empty project.
Setup code generation to debug multithreaded.

The lib linking setting is :

#pragma comment(lib,“d:/dev/3D/libraries/jpeg/jpeg.lib”)
#pragma comment(lib,“D:/Dev/3D/Libraries/glTexFont/glTexFont.lib”)

#ifdef _DEBUG
#pragma
comment(lib,“D:/Dev/3D/Libraries/SDL/SDL-1.2.5/VisualC/SDL/Debug/sdl.lib”)
#pragma
comment(lib,“D:/Dev/3D/Libraries/SDL/SDL-1.2.5/VisualC/SDLMain/Debug/sdlmain
.lib”)
#pragma
comment(lib,“D:/Dev/3D/Libraries/SDL_mixer/SDL_mixer-1.2.4/VisualC/Debug/SDL
_mixer.lib”)
#pragma
comment(lib,“d:/dev/3D/libraries/smpeg/smpeg-0.4.4/VisualC/Debug/smpeg.lib”)

#else
#pragma
comment(lib,“D:/Dev/3D/Libraries/SDL/SDL-1.2.5/VisualC/SDL/Release/sdl.lib”)
#pragma
comment(lib,“D:/Dev/3D/Libraries/SDL/SDL-1.2.5/VisualC/SDLMain/Release/sdlma
in.lib”)
#pragma
comment(lib,“D:/Dev/3D/Libraries/SDL_mixer/SDL_mixer-1.2.4/VisualC/Release/S
DL_mixer.lib”)
#pragma
comment(lib,“d:/dev/3D/libraries/smpeg/smpeg-0.4.4/VisualC/Release/smpeg.lib
”)
#endif

  1. SDL.lib, SDLMain.lib, SDL_mixer.lib and smpeg.lib have been compiled by
    myself using the untouched standard projects provided with each
    distribution.
  2. jpeg.lib and glTexFont.lib have not been compiled by myself

Here is the errors I get on link stage :

  1. libc.lib(crt0dat.obj) : error LNK2005: __cinit already defined in
    LIBCMTD.lib(crt0dat.obj)
    and ± 20 more same errors
  2. msvcrt.lib(MSVCRT.dll) : error LNK2005: _exit already defined in
    LIBCMTD.lib(crt0dat.obj)
    and ± 20 more same errors
  3. LIBCMTD.lib(crt0init.obj) : warning LNK4098: defaultlib "libc.lib"
    conflicts with use of other libs; use /NODEFAULTLIB:library
    LIBCMTD.lib(crt0init.obj) : warning LNK4098: defaultlib "msvcrt.lib"
    conflicts with use of other libs; use /NODEFAULTLIB:library

So, ignoring LIBC the libc.lib (crt0dat.obj) errors go away by NOT the
msvcrt.lib(MSVCRT.dll)
This is the first time I work on a so hudge project (at least for me) and I
don’t know what to do…

What is the problem ?
2) May be, the only libs I have not compiled (jpeg.lib and glTexFont.lib)
are causing troubles if they have not been multithreaded compiled
3) A trick I don’t know ?

Thank you for your help…___________________________________________________________
Do You Yahoo!? – Une adresse @yahoo.fr gratuite et en fran?ais !
Yahoo! Mail : http://fr.mail.yahoo.com

Here is the errors I get on link stage :

  1. libc.lib(crt0dat.obj) : error LNK2005: __cinit already defined
    in
    LIBCMTD.lib(crt0dat.obj)

From the Visual C++ menu bar: Project -> Settings -> C++ tab -> Code
Generation -> Use run-time library -> Multithreaded DLL. This is in
the FAQ at www.libsdl.org, of course.–
Matthijs Hollemans
www.allyoursoftware.com

common)

Here is the errors I get on link stage :

  1. libc.lib(crt0dat.obj) : error LNK2005: __cinit already defined
    in
    LIBCMTD.lib(crt0dat.obj)

From the Visual C++ menu bar: Project -> Settings -> C++ tab -> Code
Generation -> Use run-time library -> Multithreaded DLL. This is in
the FAQ at www.libsdl.org, of course.

Sorry, I missed the faq and followed a wrong advice given in the mail list
archive.


Do You Yahoo!? – Une adresse @yahoo.fr gratuite et en fran?ais !
Yahoo! Mail : http://fr.mail.yahoo.com

----- Original Message -----
From: matthijs@allyoursoftware.com (Matthijs Hollemans)
To:
Sent: Tuesday, November 26, 2002 7:54 PM
Subject: Re: [SDL] Linkage error with Visual C++ (okay I know this is really