I found it very tedious to install and get started with opengl programming in C++ on windows machine. I came across multiple issues, some were answered some not. To make it simple for others I'm noting it down here.
Let's get started,
Listing out configs which worked for me:
- Windows 7 64bit
- DevC++ IDE with MinGW GCC (v5.8.3)
- freeglut 2.8.1-1.mp for MSVC
- glew-1.11.0
Installation step-by-step:
- Download and install DevC++ IDE with MinGW GCC for Windows 64bit machine (Sourceforge.net link)
- Go to Tools->Check for Packages and choose one the mirror sites and click Check for updates
- Check freeglut among the list and install it, with this while creating new project, you'll find freeglut project option under Multimedia tab
- If mirror sites not working then download the DevPak for freeglut and install it using Tool->Package Manager
- Now, download freeglut for MSVC (from here) as we need import (_not static) lib and header files to copy in devcpp
- Copy header files at freeglut\include\GL\ to <DevCpp Installation directory in C drive Program files>\MinGW\include\GL\
- Copy library files at freeglut\lib\x64\ to <devCpp>\MinGW\lib\
- Also, copy freeglut.dll in bin folder in %systemroot% (C:\Windows)
- Get latest glew from here, http://sourceforge.net/projects/glew/files/glew/
- Extract it from zip and copy the contents of \include\GL\ to <DevCpp Installation directory in C drive Program files>\MinGW\include\GL\
- Similarly, copy the contents of glew\lib\Release\x64 to <Devcpp>\MinGW\lib\
- Also copy glew\bin\Release\x64\glew32.dll to %systemroot% (C:\Windows\)
- Restart devc++ IDE
Project setting:
- Create new freeglut project, you'll find it under File->New->Project->Multimedia tab
- While including header files, use freeglut.h and glut.h
- Include glew.h before than including any other header file
- In Project->Project Options->Parameters tab, remove -DFREEGLUT_STATIC for C++
You should now be good to get started!
Comment for any linking errors.
P.S.: If any "undefined reference to xxx" error is displayed, that's a linking error, some lib might be missing. To find which lib, search the xxx here, http://msdn.microsoft.com/en-us/library/windows/desktop/ms646940(v=vs.85).aspx