Computer Science Canada SDL Problem |
Author: | copthesaint [ Sun Sep 16, 2012 3:41 pm ] | ||||
Post subject: | SDL Problem | ||||
So I have been trying to play with SDL since it was another popular graphics library currently available for c++ and they are updating for OpenGL 3.0 support. which is awesome. I have linked other libraries and whatnot before like GLWF but for some reason I cant get SDL to work. I am using Visual Studio 2010 on Windows 7 and here is what I did: First downloaded SDL Dev Lib for C++ Then I extracted the folder to my C Drive I then opened Visual Studio I created a new windows 32 empty console application. Named it batman. I went to project then properties went into VC++ directories Then I set the Include as include and libary as library -> X86 bit I next went under linker input and added the library names SDL.lib and SDLmain.lib went to test it, however it gave me the error:
It compiles fine however it wont build when it gets to the linker. Here is my code I used:
If someone could help I would appreciate anything to try. |
Author: | bl0ckeduser [ Sun Sep 16, 2012 9:19 pm ] | ||||||
Post subject: | Re: SDL Problem | ||||||
Hi I've been using SDL for a few years on a variety of platforms but never with Visual Studio, nevertheless, I'm going to try to help because it's a nice library. Have you tried using this as your main declaration ?
SDL can be finnicky about how main is declared. BTW, your code for checking whether SDL initialized properly seems wrong. SDL_Init() will return 0 on success [1], so !SDL_Init (SDL_INIT_EVERYTHING) == 1 will be true if it succeeds. Also, argv should be a vector (pointer or array) of character arrays [2] rather than a character array as you have it. The use of
I hope this helps. [1] http://www.libsdl.org/docs/html/sdlinit.html [2] http://en.wikipedia.org/wiki/Main_function#C_and_C.2B.2B [3] http://stackoverflow.com/questions/1107705/systempause-why-is-it-wrong [4] http://lists.libsdl.org/pipermail/sdl-libsdl.org/2010-August/077263.html [5] SDL 1.2 example code - http://hg.libsdl.org/SDL/file/fba40d9f4a73/test |
Author: | copthesaint [ Mon Sep 17, 2012 9:23 am ] | ||||||
Post subject: | Re: SDL Problem | ||||||
I read your post and I tried what you said and you were defiantly right about the main declaration. I changed my code to:
The code complies and builds however it does not run. I get the error:
And on screen I get the prompt:
|
Author: | Ultrahex [ Mon Sep 17, 2012 10:04 am ] |
Post subject: | Re: SDL Problem |
that means that the dynamically linked library (linked at runtime) SDL.dll is not on the path. Typically people put in the same folder as the executable (.exe) or modify the path (not sure how this works on windows). |
Author: | copthesaint [ Mon Sep 17, 2012 7:03 pm ] |
Post subject: | RE:SDL Problem |
Thanks, I feel like an idiot for not checking if I put it in my folder lol. |