Advertisement

SDL library linker issues...(C++ .NET)

Started by December 12, 2004 05:23 AM
3 comments, last by rtw1701 19 years, 9 months ago
I've been at this for about 3 hours now, either I'm very oblivious to resources around, or I just haven't had luck in finding specific info to just get the SDL library functional with my application. I'll explain what I've done, maybe you can pinpoint where I messed it up. I downloaded the newest version of the SDL Dev Libraries for Win32 for VC++ 5,6,7. I extract the .lib's into MSVC++ .NET's lib folder, then the .h's into the include folder. I start a new blank project, add a .cpp. I write up a quick project to test if it's working:
#pragma comment(lib, "SDL.lib")
#pragma comment(lib, "SDLmain.lib")

#include <SDL\SDL.h>
#include <SDL\SDL_main.h>

//#include "base.h"

int main(int argc, char *argv[])
{
	//Initialize SDL
	if(!SDL_Init(SDL_INIT_VIDEO)){ return 0; }
	
	//Close SDL processes
	atexit(SDL_Quit);

	return 0;
}
When I go to compile, these are the linker error I'm recieving:
Linking...
msvcrt.lib(MSVCR71.dll) : error LNK2005: _exit already defined in LIBCMTD.lib(crt0dat.obj)
msvcrt.lib(MSVCR71.dll) : error LNK2005: _strncpy already defined in LIBCMTD.lib(strncpy.obj)
msvcrt.lib(MSVCR71.dll) : error LNK2005: _fclose already defined in LIBCMTD.lib(fclose.obj)
msvcrt.lib(MSVCR71.dll) : error LNK2005: __isctype already defined in LIBCMTD.lib(isctype.obj)
LINK : warning LNK4031: no subsystem specified; CONSOLE assumed
LIBCMTD.lib(crt0init.obj) : warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
I understand those must be conflicting function names, but I've tried to download the newest source code for SDL and compile it, then place the new compiled .lib's into the lib folder. I get the same malarky. I'm just kinda stumped what to do. I can't find any proper info anywhere, I've searched your forums, snooped the net, looked all over SDL's site. Help! =(
-Conrad
Go to your project properties, click on the C/C++ folder, and open the Code Generation tab. Change the runtime library to "Multithreaded DLL" or "Multithreaded Debug DLL" depending if you're linking a release or debug build..
Advertisement
SiCrane, what would I do without you? I can't believe I forgot to do that, I used to do SDL on VC++ 6, but .NET has all this linker stuff mixed around, I haven't dabbed into any APIs (besides W32) since I got .NET, so it's a tricky transition sometimes. Either way, that seemed to do the trick, but w/ the above code, I get this linker error:

LINK : fatal error LNK1561: entry point must be defined

A bit strange, I tried doing a plain main() w/out the arg's, but it still isn't budging. Any solutions?
-Conrad
Ok, I found out the proper info:

Quote: try setting Project Properties->Linker->Advanced->Entry Point to mainCRTStartup;


I have no idea why the entry point is being set to mainCRTStartup(). Is this the entrypoint function somewhere in the SDL libraries? My entry point function is still main().
-Conrad
Are you making it as a console application? I think you need to do that too. Least you do with v++ 6.0.

This topic is closed to new replies.

Advertisement