Hi all, I’m having some problems compiling my first SDL project in VC6. I created an empty Win32 project and wrote a simple program to set the video mode, using OpenGL. For some reason, it failed to compile, giving me the error messages:
msvcrt.lib(MSVCRT.dll) : error LNK2005: _exit already defined in LIBCD.lib(crt0dat.obj)
msvcrt.lib(MSVCRT.dll) : error LNK2005: _strncpy already defined in LIBCD.lib(strncpy.obj)
msvcrt.lib(MSVCRT.dll) : error LNK2005: _fprintf already defined in LIBCD.lib(fprintf.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/gltest.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.
I compared the project settings with the VC test projects that come with the SDL source (which compile fine) and I can’t see any difference.
Setting the “Ignore all default libraries” option, seems to prevent those errors but gives me these ones instead:
ltest.obj : error LNK2001: unresolved external symbol _fprintf
gltest.obj : error LNK2001: unresolved external symbol __iob
gltest.obj : error LNK2001: unresolved external symbol __chkesp
LINK : error LNK2001: unresolved external symbol _WinMainCRTStartup
Debug/gltest.exe : fatal error LNK1120: 4 unresolved externals
Error executing link.exe.
Does anyone have an idea what I’m doing wrong?
Thanks,
Andy Livingstone
If it helps, here are the headers i’ve used:
#include <windows.h>
#include <stdlib.h>
#include "SDl\SDL.h"
This is a common VC problem, nothing to do with SDL. Add LIBCD to the
"ignore library" (I think thats what its called) line. In the release
version add LIBC.
AndyOn Sun, 2002-07-14 at 07:36, Andy Livingstone wrote:
Hi all, I’m having some problems compiling my first SDL project in VC6. I created an empty Win32 project and wrote a simple program to set the video mode, using OpenGL. For some reason, it failed to compile, giving me the error messages:
msvcrt.lib(MSVCRT.dll) : error LNK2005: _exit already defined in LIBCD.lib(crt0dat.obj)
msvcrt.lib(MSVCRT.dll) : error LNK2005: _strncpy already defined in LIBCD.lib(strncpy.obj)
msvcrt.lib(MSVCRT.dll) : error LNK2005: _fprintf already defined in LIBCD.lib(fprintf.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/gltest.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.
At 03:36 PM 7/14/2002 +0100, you wrote:
Hi all, I’m having some problems compiling my first SDL project in VC6. I
created an empty Win32 project and wrote a simple program to set the video
mode, using OpenGL. For some reason, it failed to compile, giving me the
error messages:
msvcrt.lib(MSVCRT.dll) : error LNK2005: _exit already defined in
LIBCD.lib(crt0dat.obj)
It compiles fine but you have a linking problem.
Go to Project->Settings, Tab: “C/C++”, Category: “Code Generation”,
and make sure every project uses the same run-time library.
(Probably your empty Win32 project uses “Debug Single-Threaded” libraries
and SDL uses “Debug Multithreaded [DLL]”.
I compared the project settings with the VC test projects that come with
the SDL source (which compile fine) and I can’t see any difference.
It’s always a good idea to just copy makefiles and work from that.
Regards,
Dimitri
Thanks, it works now
I changed the runtime library to “Debug Multithreaded DLL,” and then added
msvcrt to the ignore libraries list, to get rid of the last warning.