Thread: Can't get OpenGL code from this site's tutorial to run

  1. #1
    Registered User
    Join Date
    Jun 2016

    Can't get OpenGL code from this site's tutorial to run

    I've been following the beginning OpenGL tutorial on this site, and am on this part. I copypasted the code into a new project in Visual Studio 2015, tried to run it, and got this error under the include for glaux.h:

    Cannot open source file gl/glaux.h.
    Some googling around led me to add FreeGlut to my project as an attempt to fix this. That changed nothing. And when I tried to run the project, I got this:

    fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?
    So, I added the include for stdafx.h to the file. Trying to run the code again, I got a crapton of errors. Here's a few:

    c:\users\cg-college\documents\visual studio 2015\projects\learning opengl\startwithopengl\startwithopengl\startwithop engl.cpp(41): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

    1>c:\users\cg-college\documents\visual studio 2015\projects\learning opengl\startwithopengl\startwithopengl\startwithop engl.cpp(41): error C2146: syntax error: missing ';' before identifier 'g_HDC'

    1>c:\users\cg-college\documents\visual studio 2015\projects\learning opengl\startwithopengl\startwithopengl\startwithop engl.cpp(54): error C3861: 'glPushMatrix': identifier not found

    1>c:\users\cg-college\documents\visual studio 2015\projects\learning opengl\startwithopengl\startwithopengl\startwithop engl.cpp(55): error C2065: 'GL_POLYGON': undeclared identifier
    I'm stuck. None of the errors make any sense to me, especially the one saying I'm missing a semicolon (I wasn't). I'd appreciate help with fixing this.

  2. #2
    The tutorial looks to be based on very outdated material. You'd be wasting time learning the legacy API, even if it's a bit easier to get started with.

    I recommend to instead follow a guide like that builds on modern OpenGL. Try getting started with that, and feel free to ask for help if you run into issues there.

    Other things I can recommend are:

    • glad : Ensures you have access to the modern API supported by your drivers. The best of its kind I've come across.
    • CMake : Might ease the build process as your project grows. If you'll be using Windows and VS exclusively, you might have less use for it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 05-03-2013, 08:50 AM
  2. Error I have in OpenGL tutorial on this site.
    By Nirdop in forum C++ Programming
    Replies: 4
    Last Post: 07-25-2006, 03:03 PM
  3. How effective is the tutorial on this site?
    By Raeliean in forum C++ Programming
    Replies: 5
    Last Post: 07-07-2005, 03:24 PM

Tags for this Thread