Dev cpp with SDL in windows 7

Started by
6 comments, last by 21st Century Moose 12 years, 9 months ago
I have just started learning SDL ...... i downloaded SDL files and extracted to c drive. Then i connected the directories like include files and lib files...... and just compiled simple code

[font="'Arial Black"]#include "SDL/SDL.h"int main( int argc, char* args[] )[/font]
[font="'Arial Black"]{ SDL_Init( SDL_INIT_EVERYTHING ); [/font]
[font="'Arial Black"] SDL_Quit(); [/font]
[font="'Arial Black"] return 0; [/font]
[font="'Arial Black"]}

[color="#696969"]i got linker errors like
- [Linker error] undefined reference to `SDL_Init'
- [Linker error] undefined reference to `SDL_Quit'
- [Linker error] undefined reference to `WinMain@16'
- ld returned 1 exit status


can u guyz help me?[/font]
Advertisement

I have just started learning SDL ...... i downloaded SDL files and extracted to c drive. Then i connected the directories like include files and lib files...... and just compiled simple code

[font="Arial Black"]#include "SDL/SDL.h"int main( int argc, char* args[] )[/font]
[font="Arial Black"]{ SDL_Init( SDL_INIT_EVERYTHING ); [/font]
[font="Arial Black"] SDL_Quit(); [/font]
[font="Arial Black"] return 0; [/font]
[font="Arial Black"]}

[color="#696969"]i got linker errors like
- [Linker error] undefined reference to `SDL_Init'
- [Linker error] undefined reference to `SDL_Quit'
- [Linker error] undefined reference to `WinMain@16'
- ld returned 1 exit status


can u guyz help me?[/font]


Its not enough to add the include and library directories, you need to also add the libraries, add -lSDLmain -lSDL to your project options.
[size="1"]I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!
i added this to linker
-lmingw32 -lSDLmain -lSDL

and type
WIN32 GUI
I am using windows 7.... is this a prob. for me.....?
1) Toss Dev-Cpp
2.a) Get Code::Blocks and have a look here: http://wiki.codebloc...th_Code::Blocks
2.b) Get Microsoft Visual Studio Express and have a look here: http://lazyfoo.net/SDL_tutorials/lesson01/windows/msvsnet0508e/index.php
Dev-Cpp was good in the Win95 era. You are a bit late to use it, especially with Windows7. By the way, this kind of question appear every few weeks or so on this forum. Where do you guys come from? Which tutorial/school teach you to use Dev-C++? Maybe we should stop it at the source.
One other suggestion before you get too deep, check out sfml instead of SDL. It's a more fully featured library, and, it uses HW Acceleration for graphics and Sound (sits on OpenGL and OpenAL).

sfml-dev.org They also have a tutorial on setting up sfml in Code::Blocks

My Gamedev Journal: 2D Game Making, the Easy Way

---(Old Blog, still has good info): 2dGameMaking
-----
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)

Essential reading: http://www.jasonbadams.net/20081218/why-you-shouldnt-use-dev-c/

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

This topic is closed to new replies.

Advertisement