Friday 19 January 2018

c++ - I'm trying to learn to make games with SDL. My book teaches SDL1.2.3 and I can't get it to work on Visual Studio. Can anyone help? My errors:

#include "sdl.h"
#include


#include


SDL_Surface* g_pMainSurface =
NULL;
SDL_Event g_Event;

int main(int argc, char*
argv[])
{
if (SDL_Init(SDL_INIT_VIDEO)==-1)
{

fprintf(stderr, "Could not initialize SDL!\n");


exit(1);
}

else
{
fprintf(stdout,
"SDL initialized properly!\n");
atexit(SDL_Quit);

}

g_pMainSurface = SDL_SetVideoMode(640, 480, 0,
SDL_ANYFORMAT);


if (!g_pMainSurface)

{
fprintf(stderr, "Could not creat main surface!\n");

exit(1);
}

for (;;)
{
if
(SDL_WaitEvent(&g_Event) == 0)

{

exit(1);
}

if (g_Event.type == SDL_QUIT)

{
fprintf(stdout, "Quit event has occurred.\n");
break;

}


}

fprintf(stdout, "Terminating
program normally.\n");
return
(0);
}


1>main.obj
: error LNK2019: unresolved external symbol _SDL_SetVideoMode referenced in function
_SDL_main



1>main.obj : error LNK2019:
unresolved external symbol _SDL_WaitEvent referenced in function
_SDL_main




1>main.obj : error
LNK2019: unresolved external symbol _SDL_Init referenced in function
_SDL_main



1>main.obj : error LNK2019:
unresolved external symbol _SDL_Quit referenced in function
_SDL_main



1>MSVCRT.lib(exe_winmain.obj) :
error LNK2019: unresolved external symbol _WinMain@16 referenced in function "int
__cdecl __scrt_common_main_seh(void)"
(?__scrt_common_main_seh@@YAHXZ)

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...