SDL/OpenGL commands not set in scope? -


i'm trying write simple sdl , gl program on mac create triangle, not working.

(in c++)

#include <iostream> #include "sdl/sdl.h" #include <opengl/gl.h> #include <opengl/glu.h>  /*initialize*/ void init() {     glclearcolor(0.0,0.0,0.0,1.0);     glmatrixmode(gl_projection);     glloadidentity();     gluperspective(45,640.0/480.0,1.0,500.0);     glmatrixmode(gl_modelview);     glloadidentity(); }  /*display*/ void display()   // drawing {     glclear(gl_color_buffer_bit);     glbegin(gl_triangles);      glvertex3f(0.0,2.0,-5.0);     glvertex3f(-2.0,-2.0,-5.0);     glvertex3f(2.0,-2.0,-5.0);      glend(); }  /*main*/ int main(int argc, char** argv) // arguments required {     sdl_init(sdl_init_everything); // initialize , setup sdl     sdl_surface* screen = sdl_setvideomode(640,480,32,sdl_swsurface|sdl_opengl);     bool running = true;     uint32 start;     sdl_event event;     init();      while (running)     {         start = sdl_getticks();          while (sdl_pollevent(&event))         {             switch (event.type)             {                 case sdl_quit:                     running = false;                     break;             }         }          display();         sdl_gl_swapbuffers();         if(1000/30 > (sdl_getticks() - start))             sdl_delay(1000/30 - (sdl_getticks() - start));     }     sdl_quit();     return 0;  } 

but when compile it:

computer:sdlcode user$ g++ third.cpp -gl -glu third.cpp: in function ‘int main(int, char**)’: third.cpp:34: error: ‘sdl_opengl’ not declared in scope third.cpp:34: error: ‘sdl_setvideomode’ not declared in scope third.cpp:55: error: ‘sdl_gl_swapbuffers’ not declared in scope computer:sdlcode user$  

whats going wrong here , how prevent having further commands undeclared?

i see included sdl headers through local include statement, i.e. using double quotes instead of wedges. compiler message indicates goes wrong when including sdl/sdl.h. either installation of sdl broken, or accident put empty, or mismatching sdl/sdl.h source directory.

in either case must make sure installation of sdl valid.


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo