Link Problem on windows

I have a problem:
I’m using SDL in my project and it works well on linux.
Now i try to compile it on windows and wonder what … i have a link error
!!
I have a int main( int, char ** ) function and it tells me:
LIBCMT.lib(crt0.obj) : error LNK2019: unresolved external symbol _main
referenced in function _mainCRTStartup

So i include the “sdlmain.lib” library into my project and main isn’t an
unresolved symbol annymore but these ones:

  • msvcrt.lib(ti_inst.obj) : error LNK2005: “private: __thiscall
    type_info::type_info(class type_info const &)” (??0type_info@@AAE at ABV0@@Z)
    already defined in LIBCMT.lib(typinfo.obj)
  • msvcrt.lib(ti_inst.obj) : error LNK2005: “private: class type_info &
    __thiscall type_info::operator=(class type_info const &)” (??4type_info@@
    AAEAAV0 at ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj)
  • msvcrt.lib(MSVCR80.dll) : error LNK2005: _exit already defined in
    LIBCMT.lib(crt0dat.obj)
  • msvcrt.lib(MSVCR80.dll) : error LNK2005: _strncpy already defined in
    LIBCMT.lib(strncpy.obj)
  • msvcrt.lib(MSVCR80.dll) : error LNK2005: _strrchr already defined in
    LIBCMT.lib(strrchr.obj)
  • msvcrt.lib(MSVCR80.dll) : error LNK2005: _fprintf already defined in
    LIBCMT.lib(fprintf.obj)
  • msvcrt.lib(MSVCR80.dll) : error LNK2005: _fopen already defined in
    LIBCMT.lib(fopen.obj)
  • msvcrt.lib(MSVCR80.dll) : error LNK2005: _fgetc already defined in
    LIBCMT.lib(fgetc.obj)
  • msvcrt.lib(MSVCR80.dll) : error LNK2005: _fclose already defined in
    LIBCMT.lib(fclose.obj)
  • msvcrt.lib(MSVCR80.dll) : error LNK2005: _freopen already defined in
    LIBCMT.lib(freopen.obj)
  • msvcrt.lib(MSVCR80.dll) : error LNK2005: __isctype already defined in
    LIBCMT.lib(isctype.obj)
  • LIBCMT.lib(crt0init.obj) : warning LNK4098: defaultlib 'msvcrt.lib’
    conflicts with use of other libs; use /NODEFAULTLIB:library

Then, If i du use nodefault libs, i get a lot of other standard c functions
not defined so it’s not that what i have to do …
I have the same sh* with WinMain …
I tryed everything and didn’t find a sloution so please, can someone help me
??
If i remember right i had this error already but i dont remember how i
solved it :s–

P.O.M.P.E.I. du 47-20

I got errors like these when I forgot to put the Runtime Library on Multithreaded DLL in the Code Generation tab.

Maybe u forgot this too?

Folkert----- Original Message -----
From: Pompei2
To: A list for developers using the SDL library. (includes SDL-announce)
Sent: Wednesday, June 01, 2005 7:59 PM
Subject: [SDL] Link Problem on windows

I have a problem:
I’m using SDL in my project and it works well on linux.
Now i try to compile it on windows and wonder what … i have a link error !!
I have a int main( int, char ** ) function and it tells me:
LIBCMT.lib(crt0.obj) : error LNK2019: unresolved external symbol _main referenced in function _mainCRTStartup

So i include the “sdlmain.lib” library into my project and main isn’t an unresolved symbol annymore but these ones:

  • msvcrt.lib(ti_inst.obj) : error LNK2005: “private: __thiscall type_info::type_info(class type_info const &)” (??0type_info@@AAE at ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj)
  • msvcrt.lib(ti_inst.obj) : error LNK2005: “private: class type_info & __thiscall type_info::operator=(class type_info const &)” (??4type_info@@AAEAAV0 at ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj)
  • msvcrt.lib(MSVCR80.dll) : error LNK2005: _exit already defined in LIBCMT.lib(crt0dat.obj)
  • msvcrt.lib(MSVCR80.dll) : error LNK2005: _strncpy already defined in LIBCMT.lib(strncpy.obj)
  • msvcrt.lib(MSVCR80.dll) : error LNK2005: _strrchr already defined in LIBCMT.lib(strrchr.obj)
  • msvcrt.lib(MSVCR80.dll) : error LNK2005: _fprintf already defined in LIBCMT.lib(fprintf.obj)
  • msvcrt.lib(MSVCR80.dll) : error LNK2005: _fopen already defined in LIBCMT.lib(fopen.obj)
  • msvcrt.lib(MSVCR80.dll) : error LNK2005: _fgetc already defined in LIBCMT.lib(fgetc.obj)
  • msvcrt.lib(MSVCR80.dll) : error LNK2005: _fclose already defined in LIBCMT.lib(fclose.obj)
  • msvcrt.lib(MSVCR80.dll) : error LNK2005: _freopen already defined in LIBCMT.lib(freopen.obj)
  • msvcrt.lib(MSVCR80.dll) : error LNK2005: __isctype already defined in LIBCMT.lib(isctype.obj)
  • LIBCMT.lib(crt0init.obj) : warning LNK4098: defaultlib ‘msvcrt.lib’ conflicts with use of other libs; use /NODEFAULTLIB:library

Then, If i du use nodefault libs, i get a lot of other standard c functions not defined so it’s not that what i have to do …
I have the same sh* with WinMain …
I tryed everything and didn’t find a sloution so please, can someone help me ??
If i remember right i had this error already but i dont remember how i solved it :s

P.O.M.P.E.I. du 47-20



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

Try creating a short demo app on your windows box. If successful then
it is your project, if not then it is probably your environment.

ChrisOn 6/1/05, Pompei2 wrote:

I have a problem:
I’m using SDL in my project and it works well on linux.
Now i try to compile it on windows and wonder what … i have a link error
!!


E-Mail: Chris Nystrom
Business: http://www.shaklee.net/austin
Blog: http://conversazione.blogspot.com/
AIM: nystromchris

I got errors like these when I forgot to put the Runtime Library on
Multithreaded DLL in the Code Generation tab.

Thank you a lot !! it worked for me !!
But … on the Open Watcom compiler, i cant choose it, so annyone knows how
to do it there ??

Try creating a short demo app on your windows box. If successful then

it is your project, if not then it is probably your environment.

Good idea maybe i’ll do with Open Watcom. Thanx !–

P.O.M.P.E.I. du 47-20