Link problem with SDL

Hi all,

I?ve found an error in my program when I?ve tried to link my program. I?ve
configured my environment (VC++ 7.1) as multithreaded DLL and linked the
correct libraries. I?ve started a new project (Win32 program) and I?ve
inserted the following simple code:

#include
#include
#include “sdl.h”

int main( int argc, char *argv[] ){
printf( “>Iniciando SDL…\n” );
if( SDL_Init( SDL_INIT_VIDEO ) < 0 ) {
printf( “Error al iniciar SDL.\n” );
return -1;
}
printf( “>SDL Iniciado.\n” );

printf( ">Creando ventana.\n" );
if( SDL_SetVideoMode( 400, 400, 16, 0 ) == NULL ) {
	printf( "Error al setear modo de video: %s\n",

SDL_GetError() );
SDL_Quit();
return -1;
}

SDL_WM_SetCaption( "Hola mundo!", "Hola Mundo!" );

SDL_Delay( 5000 );

printf( ">Cerrando SDL ...\n" );
SDL_Quit();

printf( ">SDL Terminado.\n" );

return 0;

}

The linker always says that exit() is always defined. There are other ways
to link SDL libs, different than the documentation? It exists a trick to
solve this problem?
Note: If I delete #include then exit() symbol is not found.

Thanks in advance!
Ferran Ferri–
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.392 / Virus Database: 268.5.5/333 - Release Date: 05/05/2006


LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y m?viles desde 1 c?ntimo por minuto.
http://es.voice.yahoo.com

I’ve found an error in my program when I’ve tried to link my program. I’ve
configured my environment (VC++ 7.1) as multithreaded DLL and linked the
correct libraries. I’ve started a new project (Win32 program) and I’ve
inserted the following simple code:

#include
#include

What happens if you #include the normal CRT headers instead of the STL
ones? (i.e. #include <stdio.h> and #include <stdlib.h> instead)

The linker always says that exit() is always defined.

What’s the linker error message exactly?–
Regads,
Rasmus Neckelmann
http://royal.flof.dk/rasmus

Hi Rasmus,

Error message always is:

msvcrt.lib(MSVCR71.dll) : error LNK2005: _exit already defined in
LIBCD.lib(crt0dat.obj)
msvcrt.lib(MSVCR71.dll) : error LNK2005: _strncpy already defined in
LIBCD.lib(strncpy.obj)
msvcrt.lib(MSVCR71.dll) : error LNK2005: _fclose already defined in
LIBCD.lib(fclose.obj)
msvcrt.lib(MSVCR71.dll) : error LNK2005: __isctype already defined in
LIBCD.lib(isctype.obj)
Finished searching libraries
LIBCD.lib(crt0init.obj) : warning LNK4098: defaultlib ‘msvcrt.lib’ conflicts
with use of other libs; use /NODEFAULTLIB:library
Debug/Prueba_SDL_and_OpenGL.exe : fatal error LNK1169: one or more multiply
defined symbols found

Even if I include stdio.h and stdlib.h.
My solution at this moment is to force link the libraries, but I guess that
other way is possible.

Thanks
Ferran Ferri
RedSauce S.L.

|-----Mensaje original-----
|De: sdl-bounces+ferranferri=yahoo.es at libsdl.org [mailto:sdl-
|bounces+ferranferri=yahoo.es at libsdl.org] En nombre de Rasmus Neckelmann
|Enviado el: mi?rcoles, 10 de mayo de 2006 10:55
|Para: A list for developers using the SDL library. (includes SDL-announce)
|Asunto: Re: [SDL] link problem with SDL
|
|> I’ve found an error in my program when I’ve tried to link my program.
|I’ve
|> configured my environment (VC++ 7.1) as multithreaded DLL and linked the
|> correct libraries. I’ve started a new project (Win32 program) and I’ve
|> inserted the following simple code:
|>
|> #include
|> #include
|
|What happens if you #include the normal CRT headers instead of the STL
|ones? (i.e. #include <stdio.h> and #include <stdlib.h> instead)
|
|> The linker always says that exit() is always defined.
|
|What’s the linker error message exactly?

Regads,
Rasmus Neckelmann
http://royal.flof.dk/rasmus
_______________________________________________
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.392 / Virus Database: 268.5.5/335 - Release Date: 09/05/2006

No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.392 / Virus Database: 268.5.5/335 - Release Date: 09/05/2006


LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y m?viles desde 1 c?ntimo por minuto.
http://es.voice.yahoo.com

It seems that you are mixing up debug and release libraries in some way.
Under “Code generation” configuration, have you selected
"Multithreaded DLL" or “Multithreaded Debug DLL”? (can’t remember the
exact names)
You need to select the debug one.On 5/10/06, Ferran Ferri wrote:

Error message always is:

msvcrt.lib(MSVCR71.dll) : error LNK2005: _exit already defined in
LIBCD.lib(crt0dat.obj)
msvcrt.lib(MSVCR71.dll) : error LNK2005: _strncpy already defined in
LIBCD.lib(strncpy.obj)
msvcrt.lib(MSVCR71.dll) : error LNK2005: _fclose already defined in
LIBCD.lib(fclose.obj)
msvcrt.lib(MSVCR71.dll) : error LNK2005: __isctype already defined in
LIBCD.lib(isctype.obj)


Regards,
Rasmus Neckelmann
http://royal.flof.dk/rasmus

Ohhhh, thanks. The problem is solved and it Works perfectly. Thanks
Rasmus!!!

Ferran Ferri
RedSauce S.L.

|-----Mensaje original-----
|De: sdl-bounces+ferranferri=yahoo.es at libsdl.org [mailto:sdl-
|bounces+ferranferri=yahoo.es at libsdl.org] En nombre de Rasmus Neckelmann
|Enviado el: mi?rcoles, 10 de mayo de 2006 11:11
|Para: A list for developers using the SDL library. (includes SDL-announce)
|Asunto: Re: [SDL] link problem with SDL
|
|On 5/10/06, Ferran Ferri <@Ferran_Ferri> wrote:
|> Error message always is:
|>
|> msvcrt.lib(MSVCR71.dll) : error LNK2005: _exit already defined in
|> LIBCD.lib(crt0dat.obj)
|> msvcrt.lib(MSVCR71.dll) : error LNK2005: _strncpy already defined in
|> LIBCD.lib(strncpy.obj)
|> msvcrt.lib(MSVCR71.dll) : error LNK2005: _fclose already defined in
|> LIBCD.lib(fclose.obj)
|> msvcrt.lib(MSVCR71.dll) : error LNK2005: __isctype already defined in
|> LIBCD.lib(isctype.obj)
|
|It seems that you are mixing up debug and release libraries in some way.
|Under “Code generation” configuration, have you selected
|“Multithreaded DLL” or “Multithreaded Debug DLL”? (can’t remember the
|exact names)
|You need to select the debug one.

Regards,
Rasmus Neckelmann
http://royal.flof.dk/rasmus
_______________________________________________
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.392 / Virus Database: 268.5.5/335 - Release Date: 09/05/2006

No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.392 / Virus Database: 268.5.5/335 - Release Date: 09/05/2006


LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y m?viles desde 1 c?ntimo por minuto.
http://es.voice.yahoo.com