SDL won't init on Win32, under .NET

This is my program:

#include “SDL.h” /* All SDL App’s need this */
#include <stdio.h>

int main() {

printf(“Initializing SDL.\n”);

/* Initialize defaults, Video and Audio */
if((SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO)==-1)) {
printf(“Could not initialize SDL: %s.\n”, SDL_GetError());
return -1;
}

printf(“SDL initialized.\n”);

printf(“Quiting SDL.\n”);

/* Shutdown all subsystems */
SDL_Quit();

printf(“Quiting…\n”);
return 0;
}

These are my errors:

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)
LIBCD.lib(crt0init.obj) : warning LNK4098: defaultlib ‘msvcrt.lib’ conflicts
with use of other libs; use /NODEFAULTLIB:library
SDLmain.lib(SDL_win32_main.obj) : error LNK2019: unresolved external symbol
_SDL_main referenced in function _main

I’ve tried not importing LBCD and using /NODEFAULTLIB but those cause other
problems:
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)
LIBCD.lib(crt0init.obj) : warning LNK4098: defaultlib ‘msvcrt.lib’ conflicts
with use of other libs; use /NODEFAULTLIB:library
SDLmain.lib(SDL_win32_main.obj) : error LNK2019: unresolved external symbol
_SDL_main referenced in function _main

you should use

int main(int argc, char *argv[])

instead of

int main()

s pozdravem-------------------------------
Tom?? Lamr …
josh :: PodVlivem Software
www.podvlivem.net
icq: 91847172
@Tomas_Lamr

  1. kv?tna 2004, 6:51:24, napsal jste:

KJ> This is my program:

KJ> #include “SDL.h” /* All SDL App’s need this */
KJ> #include <stdio.h>

KJ> int main() {

KJ> printf(“Initializing SDL.\n”);

KJ> /* Initialize defaults, Video and Audio */
KJ> if((SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO)==-1)) {
KJ> printf(“Could not initialize SDL: %s.\n”, SDL_GetError());
KJ> return -1;
KJ> }

KJ> printf(“SDL initialized.\n”);

KJ> printf(“Quiting SDL.\n”);

KJ> /* Shutdown all subsystems */
KJ> SDL_Quit();

KJ> printf(“Quiting…\n”);
KJ> return 0;
KJ> }

KJ> These are my errors:

KJ> msvcrt.lib(MSVCR71.dll) : error LNK2005: _exit already defined in
KJ> LIBCD.lib(crt0dat.obj)
KJ> msvcrt.lib(MSVCR71.dll) : error LNK2005: _strncpy already defined in
KJ> LIBCD.lib(strncpy.obj)
KJ> msvcrt.lib(MSVCR71.dll) : error LNK2005: _fclose already defined in
KJ> LIBCD.lib(fclose.obj)
KJ> msvcrt.lib(MSVCR71.dll) : error LNK2005: __isctype already defined in
KJ> LIBCD.lib(isctype.obj)
KJ> LIBCD.lib(crt0init.obj) : warning LNK4098: defaultlib ‘msvcrt.lib’ conflicts
KJ> with use of other libs; use /NODEFAULTLIB:library
KJ> SDLmain.lib(SDL_win32_main.obj) : error LNK2019: unresolved external symbol
KJ> _SDL_main referenced in function _main

KJ> I’ve tried not importing LBCD and using /NODEFAULTLIB but those cause other
KJ> problems:
KJ> msvcrt.lib(MSVCR71.dll) : error LNK2005: _exit already defined in
KJ> LIBCD.lib(crt0dat.obj)
KJ> msvcrt.lib(MSVCR71.dll) : error LNK2005: _strncpy already defined in
KJ> LIBCD.lib(strncpy.obj)
KJ> msvcrt.lib(MSVCR71.dll) : error LNK2005: _fclose already defined in
KJ> LIBCD.lib(fclose.obj)
KJ> msvcrt.lib(MSVCR71.dll) : error LNK2005: __isctype already defined in
KJ> LIBCD.lib(isctype.obj)
KJ> LIBCD.lib(crt0init.obj) : warning LNK4098: defaultlib ‘msvcrt.lib’ conflicts
KJ> with use of other libs; use /NODEFAULTLIB:library
KJ> SDLmain.lib(SDL_win32_main.obj) : error LNK2019: unresolved external symbol
KJ> _SDL_main referenced in function _main

KJ> _______________________________________________
KJ> SDL mailing list
KJ> SDL at libsdl.org
KJ> http://www.libsdl.org/mailman/listinfo/sdl

Kevin Jenkins wrote:

This is my program:

#include “SDL.h” /* All SDL App’s need this */
#include <stdio.h>

int main() {

printf(“Initializing SDL.\n”);

/* Initialize defaults, Video and Audio */
if((SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO)==-1)) {
printf(“Could not initialize SDL: %s.\n”, SDL_GetError());
return -1;
}

printf(“SDL initialized.\n”);

printf(“Quiting SDL.\n”);

/* Shutdown all subsystems */
SDL_Quit();

printf(“Quiting…\n”);
return 0;
}

These are my errors:

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)
LIBCD.lib(crt0init.obj) : warning LNK4098: defaultlib ‘msvcrt.lib’ conflicts
with use of other libs; use /NODEFAULTLIB:library
SDLmain.lib(SDL_win32_main.obj) : error LNK2019: unresolved external symbol
_SDL_main referenced in function _main

I’ve tried not importing LBCD and using /NODEFAULTLIB but those cause other
problems:
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)
LIBCD.lib(crt0init.obj) : warning LNK4098: defaultlib ‘msvcrt.lib’ conflicts
with use of other libs; use /NODEFAULTLIB:library
SDLmain.lib(SDL_win32_main.obj) : error LNK2019: unresolved external symbol
_SDL_main referenced in function _main


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

I refer you to the following:

http://www.libsdl.org/faq.php?action=listentries&category=4#43
and
http://www.libsdl.org/faq.php?action=listentries&category=4#48

Following these FAQ questions should fix your issues.

-TomT64