Jump to content
  • Advertisement
Sign in to follow this  
jdude

SDL problems :-(

This topic is 4977 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 installed SDL and I copied the sdl.dll to my project folder, and when I compile I get this error:
In file included from C:/Dev-Cpp/include/SDL/SDL.h:39,
from main.c:1:
C:/Dev-Cpp/include/SDL/SDL_audio.h:97: error: syntax error before `[' token
Anyone know how to fix it?

Share this post


Link to post
Share on other sites
Advertisement
Quote:

#include <SDL/SDL.h>
#include <gl/gl.h>

/*
PLEASE NOTE: the program will require SDL.dll which is located in
dev-c++'s dll directory. You have to copy it to you
program's home directory or the path.
*/

int main(int argc, char *argv[]){
SDL_Event event;
float theta = 0.0f;

SDL_Init(SDL_INIT_VIDEO);
SDL_SetVideoMode(600, 300, 0, SDL_OPENGL | SDL_HWSURFACE | SDL_NOFRAME);

glViewport(0, 0, 600, 300);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClearDepth(1.0);
glDepthFunc(GL_LESS);
glEnable(GL_DEPTH_TEST);
glShadeModel(GL_SMOOTH);
glMatrixMode(GL_PROJECTION);
glMatrixMode(GL_MODELVIEW);

int done;
for(done = 0; !done;){
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glLoadIdentity();
glTranslatef(0.0f,0.0f,0.0f);
glRotatef(theta, 0.0f, 0.0f, 1.0f);

glBegin(GL_TRIANGLES);
glColor3f(1.0f, 0.0f, 0.0f);
glVertex2f(0.0f, 1.0f);
glColor3f(0.0f, 1.0f, 0.0f);
glVertex2f(0.87f, -0.5f);
glColor3f(0.0f, 0.0f, 1.0f);
glVertex2f(-0.87f, -0.5f);
glEnd();

theta += .5f;
SDL_GL_SwapBuffers();
SDL_PollEvent(&event);
if(event.key.keysym.sym == SDLK_ESCAPE)
done = 1;
}
SDL_Quit();
return(0);
}

Share this post


Link to post
Share on other sites
Quote:
Original post by jdude
I installed SDL and I copied the sdl.dll to my project folder, and when I compile I get this error:

In file included from C:/Dev-Cpp/include/SDL/SDL.h:39,
from main.c:1:
C:/Dev-Cpp/include/SDL/SDL_audio.h:97: error: syntax error before `[' token

Anyone know how to fix it?


It's an error in the SDL_audio page. You could look at line 97 there, and see if it's just a typo, or, if it's not the latest version, download the new one, or, if it is, get the one right before it.

Cheers

Share this post


Link to post
Share on other sites
The only way to currently fix that is comment that line out. It is a problem with the newest SDL 1.2.8 and Dev-CPP. The other alternative is to revert back to 1.2.7.

- Drew

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!