# Argh, link failed with SDL >.<

This topic is 2613 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, recently I wanted to try to use 3rd party library, in this case it's SDL. So I coded a simplest SDL app possible like this:
 #include "SDL\sdl.h" #include <stdio.h> int main(int argc, char** argv) { return 0; } 

I've put the headers in the right folder, there should be no problem with missing headers, etc... but I always got the error:

[color="#FF0000"]--------------------Configuration: test - Win32 Debug--------------------
Compiling...
main.cpp
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/test.exe : fatal error LNK1120: 1 unresolved externals

test.exe - 2 error(s), 0 warning(s)

it happens if I don't link the project with the library (.lib file). but even after I link it, there's still some errors (even worse), like:

[color="#FF0000"]--------------------Configuration: test - Win32 Debug--------------------
Compiling...
main.cpp
msvcrt.lib(MSVCRT.dll) : error LNK2005: _exit already defined in LIBCD.lib(crt0dat.obj)
msvcrt.lib(MSVCRT.dll) : error LNK2005: _fclose already defined in LIBCD.lib(fclose.obj)
msvcrt.lib(MSVCRT.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
Debug/test.exe : fatal error LNK1169: one or more multiply defined symbols found

test.exe - 4 error(s), 1 warning(s)

I've been googling to see if someone experienced similar problems, but I ran out of luck (or am just being lazy ). I'm using MSVC6.0 (I know, stop blaming me for using OLD IDE). I've tried to pick n play the configuration but it still didn't work. I'm confused and beg anyone to help. Thanks before

Best Regards,

Bow Vernon

##### Share on other sites
Either #undef main, or use SDL_Main in place of main.

##### Share on other sites
Umm never mind, I already solved it by setting the code generation to "Multithreaded DLL" and it works fine now! thanks for the response though

1. 1
2. 2
Rutin
21
3. 3
4. 4
A4L
15
5. 5
khawk
14

• 13
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633737
• Total Posts
3013613
×