Thread: OpenGL/GLUT in Dev C++

  1. #1
    Registered User
    Join Date
    Aug 2008
    Posts
    55

    OpenGL/GLUT in Dev C++

    I'm just trying to get a simple program up and running using openGl but I'm having a hard time figuring it out. As I understand it, openGl comes with windows right? I downloaded the glut package from update menu in dev c++. I tried running this hello world source from wikibooks but I get linker errors like "undefined reference to 'glutInit'.
    Code:
    #include <gl/gl.h>
    #include <gl/glut.h>
    #include <gl/glu.h>
    
    
    int main(int argc, char *argv[])
    {
           glutInit(&argc, argv);
           glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
           glutInitWindowSize(800,600);
           glutCreateWindow("Hello World");
           glutMainLoop();
           
           return 0;
    }
    Thanks for any help.

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    You have to link with the GL and GLUT libraries as well. On Dev-C++ you can "add these commands to the linker command line" under compiler options, or if you have a project you can set up the libraries in project options. In fact if you had chosen OpenGL project from the list in Dev-C++ in the first place they'd already be there.

  3. #3
    Registered User
    Join Date
    Aug 2008
    Posts
    55
    Thanks alot. I didn't even realize those options existed, I just always started with a blank source.

  4. #4
    Allways learning cs_student's Avatar
    Join Date
    Aug 2008
    Location
    ~/
    Posts
    39
    You may want to try video tutorials rock.com for tutorials as the formerly suggested ones at nehe are getting to be even more outdated (GLUT itself is old) and do not meet my standards.

    You can check out gamedev.net to get more information on openGL and glut.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Whats better, C-Free or Dev C++??
    By i_can_do_this in forum Tech Board
    Replies: 10
    Last Post: 07-07-2006, 04:34 AM
  2. Resources with Dev C++ Problem (many simple problems)
    By Zeusbwr in forum Windows Programming
    Replies: 4
    Last Post: 04-06-2005, 11:08 PM
  3. New to Dev C++/<windows.h>...
    By Cilius in forum C++ Programming
    Replies: 3
    Last Post: 02-23-2005, 01:05 AM
  4. Glut and Dev C++, Programs not Quitting?
    By Zeusbwr in forum Game Programming
    Replies: 13
    Last Post: 11-29-2004, 08:43 PM
  5. DEV C++ Limitations?
    By Kirdra in forum Game Programming
    Replies: 3
    Last Post: 09-09-2002, 09:40 PM