Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


OpenGL Installation

This topic is 5643 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

Hi All: I am new in the OpenGL. I just follow the tutorial to write my first OpenGL program. I got compile error. I do not know where I missed. I appreciate any information. I added opengl32.lib, glu32.lib and Glaux.lib to my lnik. There are 4 line son top of my source code like following #include <windows.h> #include <gl\gl.h> #include <gl\glu.h> #incldue After I add code like the tutorial, I got compile error. Did I miss anything are there any place to check my OpenGL is correctly installed. Thanks in advance Inung Huang

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
Hi Inung,

Did you type all the code correctly? If you did then its to do with that 4th include - at a guess (but don''t quote me on it )it should probably be #include <gl/glaux.h>.

I have never actually ever had to set OpenGL up on a Windows box, and some of the compilers have the header files included with them anyway.

If you ever need help on forums/mailing lists, and have a compiler error it can be helpful to give us the error itself so that we can diagnose your problem quickly


Share this post

Link to post
Share on other sites
Thanks for reply.

I use VC++ and get a lot of message from compile.
The first one is
c:\Documents and Settings\Inung Huang\My Documents\My ICCSI\OpenGL\POpenGL1\OpenGL2\OpenGL2\OpenGL2.cpp(152): error C2146: syntax error : missing '';'' before identifier ''ReSizeGLScene''

The second one is
c:\Documents and Settings\Inung Huang\My Documents\My ICCSI\OpenGL\POpenGL1\OpenGL2\OpenGL2\OpenGL2.cpp(152): error C2501: ''GLvoid'' : missing storage-class or type specifiers

I checked the incldue files exist in the \include\gl folder and GLvoid is declared in gthe header file.

I also checked the dll and lib files. They exsit.

I do not have clue what I should check.

According to the tutorial, it should work. Thanks for helping.


Share this post

Link to post
Share on other sites
That is probably not a header problem but a typo when you copied the program over. For future reference, it''s best to include the error message and the applicable source code if you can''t find a bug. Also, always spend a lot of time looking for a bug before posting. I know you''re a newbie so it''s no big deal, but some people aren''t very patient.

Share this post

Link to post
Share on other sites
I spend a few days on it.
Thanks for helping.
Here is the source code for my OpenGL2.cpp

Actually, there is none my code.
The code afre generate by VC++ and copy from the tutorial.

I do not know should I take out the code generated by VC++ compile.

I have the header and the last function from tutorial.
The rest are VC++ code. If I take out the last function then the VC++ compile. I really appreciate your help.

// OpenGL2.cpp : Defines the class behaviors for the application.

#include <windows.h> // Header File For Windows
#include "gl\GL.h" // Header File For The OpenGL32 Library
#include "gl\GLU.h" // Header File For The GLu32 Library
#include "gl\GLAux.h" // Header File For The GLaux Library

#include "stdafx.h"
#include "OpenGL2.h"
#include "MainFrm.h"

#include "ChildFrm.h"
#include "OpenGL2Doc.h"
#include "OpenGL2View.h"

#ifdef _DEBUG
#define new DEBUG_NEW

HGLRC hRC=NULL; // Permanent Rendering Context
HDC hDC=NULL; // Private GDI Device Context
HWND hWnd=NULL; // Holds Our Window Handle
HINSTANCE hInstance; // Holds The Instance Of The Application

bool keys[256]; // Array Used For The Keyboard Routine
bool active=TRUE; // Window Active Flag Set To TRUE By Default
bool fullscreen=TRUE; // Fullscreen Flag Set To Fullscreen Mode By Default

// COpenGL2App

// Standard file based document commands
// Standard print setup command

// COpenGL2App construction

// TODO: add construction code here,
// Place all significant initialization in InitInstance

// The one and only COpenGL2App object

COpenGL2App theApp;

// COpenGL2App initialization

BOOL COpenGL2App::InitInstance()
// InitCommonControls() is required on Windows XP if an application
// manifest specifies use of ComCtl32.dll version 6 or later to enable
// visual styles. Otherwise, any window creation will fail.


// Initialize OLE libraries
if (!AfxOleInit())
return FALSE;
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need
// Change the registry key under which our settings are stored
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
LoadStdProfileSettings(4); // Load standard INI file options (including MRU)
// Register the application''s document templates. Document templates
// serve as the connection between documents, frame windows and views
CMultiDocTemplate* pDocTemplate;
pDocTemplate = new CMultiDocTemplate(IDR_OpenGL2TYPE,
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
// create main MDI Frame window
CMainFrame* pMainFrame = new CMainFrame;
if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
return FALSE;
m_pMainWnd = pMainFrame;
// call DragAcceptFiles only if there''s a suffix
// In an MDI app, this should occur immediately after setting m_pMainWnd
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
// Dispatch commands specified on the command line. Will return FALSE if
// app was launched with /RegServer, /Register, /Unregserver or /Unregister.
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// The main window has been initialized, so show and update it
return TRUE;

// CAboutDlg dialog used for App About

class CAboutDlg : public CDialog

// Dialog Data
enum { IDD = IDD_ABOUTBOX };

virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support

// Implementation

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)

void CAboutDlg::DoDataExchange(CDataExchange* pDX)


// App command to run the dialog
void COpenGL2App::OnAppAbout()
CAboutDlg aboutDlg;

GLvoid ReSizeGLScene(GLsizei width, GLsizei height) // Resize And Initialize The GL Window
if (height==0) // Prevent A Divide By Zero By
height=1; // Making Height Equal One

glViewport(0, 0, width, height); // Reset The Current Viewport
glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
glLoadIdentity(); // Reset The Projection Matrix

// Calculate The Aspect Ratio Of The Window

glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
glLoadIdentity(); // Reset The Modelview Matrix

// COpenGL2App message handlers

Share this post

Link to post
Share on other sites
Usually, and i don''t know how your system is setup, the openGL header files are in the include directory of your compiler. Then, you would write

#include <GL/gl.h>

instead of

#include "gl/GL.h"

Also, the gl.h file is usually lowercase and the directory uppercase, or at least that''s how it is on my computer.

Share this post

Link to post
Share on other sites
Thanks for response.

My machine is gl\GL.h, but I tried both way.
I noticed VC++ is case sensitive.

It looks that VC++ does not reconize my GL code.
I check the inclde directory exist in the configuration.

Any thing else I am missing?

Thanks again.

Inung Huang

Share this post

Link to post
Share on other sites
May I copy those gl.h file to my include directory instead of gl directory?

Will it help?

Any suggestions are appreciated.

Inung Huang

Share this post

Link to post
Share on other sites

  • 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!