Sign in to follow this  
Dr.Champ

Dev cpp with SDL in windows 7

Recommended Posts

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"][size="2"]#include "SDL/SDL.h"int main( int argc, char* args[] )[/size][/font]
[font="'Arial Black"][size="2"]{ SDL_Init( SDL_INIT_EVERYTHING ); [/size][/font]
[font="'Arial Black"][size="2"] SDL_Quit(); [/size][/font]
[font="'Arial Black"][size="2"] return 0; [/size][/font]
[font="'Arial Black"][size="2"]}[/size]

[color="#696969"][b][size="2"]i got linker errors like[/size]
[size="2"]- [Linker error] undefined reference to `SDL_Init' [/size]
[size="2"]- [Linker error] undefined reference to `SDL_Quit' [/size]
[size="2"]- [Linker error] undefined reference to `WinMain@16' [/size]
[/b][size="2"][b]- ld returned 1 exit status [/b][/size][/color]
[size="2"][b]
[/b][/size]
[size="2"][b]can u guyz help me?[/b][/size][/font]

Share this post


Link to post
Share on other sites
[quote name='Dr.Champ' timestamp='1310560796' post='4834802']
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"][size="2"]#include "SDL/SDL.h"int main( int argc, char* args[] )[/size][/font]
[font="Arial Black"][size="2"]{ SDL_Init( SDL_INIT_EVERYTHING ); [/size][/font]
[font="Arial Black"][size="2"] SDL_Quit(); [/size][/font]
[font="Arial Black"][size="2"] return 0; [/size][/font]
[font="Arial Black"][size="2"]}[/size]

[color="#696969"][b][size="2"]i got linker errors like[/size]
[size="2"]- [Linker error] undefined reference to `SDL_Init' [/size]
[size="2"]- [Linker error] undefined reference to `SDL_Quit' [/size]
[size="2"]- [Linker error] undefined reference to `WinMain@16' [/size]
[/b][size="2"][b]- ld returned 1 exit status [/b][/size][/color]
[size="2"][b]
[/b][/size]
[size="2"][b]can u guyz help me?[/b][/size][/font]
[/quote]

Its not enough to add the include and library directories, you need to also add the libraries, add -lSDLmain -lSDL to your project options.

Share this post


Link to post
Share on other sites
1) Toss Dev-Cpp
2.a) Get Code::Blocks and have a look here: [url="http://wiki.codeblocks.org/index.php?title=Using_SDL_with_Code::Blocks"]http://wiki.codebloc...th_Code::Blocks[/url]
2.b) Get Microsoft Visual Studio Express and have a look here: [url="http://lazyfoo.net/SDL_tutorials/lesson01/windows/msvsnet0508e/index.php"]http://lazyfoo.net/SDL_tutorials/lesson01/windows/msvsnet0508e/index.php[/url]

Share this post


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

Share this post


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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this