Jump to content
  • Advertisement
Sign in to follow this  
mastersmith

SDL linking error from hateez

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
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 ;
}
///////////////////////////////////////////////////////////////////////////////////

Share this post


Link to post
Share on other sites
at the sdl website theres a faq i think that tells u how to get it setup with windows

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!