SDL linking error from hateez

Started by
13 comments, last by zedz 16 years, 8 months ago
I recently tried to setup SDL, I got everything working except one thing. it keeps giving me this linking error, SDLtest error LNK2019: unresolved external symbol __alloca_probe_16 referenced in function _main wtf? this doesn't even have anything to do with the project. I looked all over the web for a fix and I couldn't find one, please help me. thanx :D
Advertisement
sorry I forget to say that I am using vs 2003.
anyone?
I don't use Visual Studio, but post the source and your linker options (the ones important to SDL anyway: libraries).

Try to cut back the source to the minimum amount of code required to generate the error.
I believe it has nothing to do with the libraries, but just this...

#include "SDL.h"

const int WINDOW_WIDTH = 640;
const int WINDOW_HEIGHT = 480;
const char* WINDOW_TITLE = "SDL Start";

int main(int argc, char **argv)
{
SDL_Init( SDL_INIT_VIDEO );

SDL_Surface* screen = SDL_SetVideoMode( WINDOW_WIDTH, WINDOW_HEIGHT, 0,
SDL_HWSURFACE | SDL_DOUBLEBUF );
SDL_WM_SetCaption( WINDOW_TITLE, 0 );

SDL_Quit();

return 0;
}

and actually I commented out everything besides the main part, and it even gives me another error then
SDLtest error LNK2005: _main already defined in main.obj

SDLtest error LNK2019: unresolved external symbol _SDL_main referenced in function _main

I have it on multi threaded dll

linking to these two libraries sdl.lib sdlmain.lib

im ignoring these two libraries msvcrt.lib libcmtd.lib

and I have the directories setup for both sdl/lib and sdl/include
Quote:Original post by mastersmith
im ignoring these two libraries msvcrt.lib libcmtd.lib


What do you mean you're ignoring them? I don't know what libcmtd.lib is, but msvcrt.lib looks suspiciously like what Microsoft would call its "common runtime" (ie the libc). Not linking it in is likely to cause problems.

I'm not a Windows developer BTW, and English isn't my native language. Sorry if I missed the point entirely.
Quote:Original post by mastersmith
I believe it has nothing to do with the libraries, but just this...

#include "SDL.h"

const int WINDOW_WIDTH = 640;
const int WINDOW_HEIGHT = 480;
const char* WINDOW_TITLE = "SDL Start";

int main(int argc, char **argv)
{
SDL_Init( SDL_INIT_VIDEO );

SDL_Surface* screen = SDL_SetVideoMode( WINDOW_WIDTH, WINDOW_HEIGHT, 0,
SDL_HWSURFACE | SDL_DOUBLEBUF );
SDL_WM_SetCaption( WINDOW_TITLE, 0 );

SDL_Quit();

return 0;
}

and actually I commented out everything besides the main part, and it even gives me another error then
SDLtest error LNK2005: _main already defined in main.obj

SDLtest error LNK2019: unresolved external symbol _SDL_main referenced in function _main

I have it on multi threaded dll

linking to these two libraries sdl.lib sdlmain.lib

im ignoring these two libraries msvcrt.lib libcmtd.lib

and I have the directories setup for both sdl/lib and sdl/include


Try using

 int main(int argc, char *argv[])
instead of char **argv. SDL is quite picky about that.

Make sure you've definitely got the libraries set up properly, and don't "ignore" the other two; msvcrt.lib is definitely an MS runtime and you'll most likely be wanting that.

You said you're using VS2003, so this might help. I personally use SDL under VS2005 but the setup procedure is very similar.

Good luck!

sdl_test fatal error LNK1104: cannot open file 'and.obj'
when I type this

#include <iostream>

///////////////////////////////////////////////////////////////////////////////////
// Namespace access permission.

using namespace std ;

///////////////////////////////////////////////////////////////////////////////////
// Main entry point.

int main( int argc, char* argv[] )
{
cout << "Hello World!" ;

cin.get() ;
return 0 ;
}
///////////////////////////////////////////////////////////////////////////////////
at the sdl website theres a faq i think that tells u how to get it setup with windows
sdl_test fatal error LNK1104: cannot open file 'and.obj'

still get the same error

This topic is closed to new replies.

Advertisement