Thursday, August 23, 2012

Windows 7: Eclipse CDT + OpenGL + MinGW Part 4

Setting up the FreeGLUT project


  1. In Eclipse...
  2. File > New > Project > C/C++ > C++ Project
  3. Hello World C++ Project w/ MinGW GCC
  4. If you didn't see MinGW GCC then uncheck the box "Show project types and ....".
  5. Name the project and finish.
  6. Copy the lib and include folders you've been adding things to over to the eclipse_workspace folder and place them next to the project's src folder.
  7. In Eclipse, right click on the project > Properties > C/C++ Build > Settings
  8. GCC C++ Compiler > Includes > Include paths (-I)
  9. Click the button with the green plus sign and add the "workspace" path to your folder "include" that you copied into the project folder.
  10. MinGW C++ Linker > Libraries.
  11. Go to Libraries (-l) and add: "glu32", "opengl32", "freeglut".
  12. These need to be in a proper order to try to keep them in the order I just described, from the top to the bottom (glew32 on top, then glfw, then...).
  13. Go to Library search path (-L)
  14. Add the "workspace" path to the "lib" folder you copied into the project folder.
  15. Click "Apply" and "Ok".
  16. Take the .dll's you copied into your "bin" folder and copy them into the project's "debug" or "release" folder. I use "debug", and it's what I've confirmed to work, so copy them into the "debug" folder.
  17. Copy and paste the code here over the hello world code. This will run the spinning cube dude:  http://pastebin.com/RfdPESsz
  18. Right click the project and "Build" (or hit the hammer button up top).
  19. Right click the project and "Run As" > "Local C/C++ Application".
Setting up the GLFW project


  1. In Eclipse...
  2. File > New > Project > C/C++ > C++ Project
  3. Hello World C++ Project w/ MinGW GCC
  4. If you didn't see MinGW GCC then uncheck the box "Show project types and ....".
  5. Name the project and finish.
  6. Copy the lib and include folders you've been adding things to over to the eclipse_workspace folder and place them next to the project's src folder.
  7. In Eclipse, right click on the project > Properties > C/C++ Build > Settings
  8. GCC C++ Compiler > Includes > Include paths (-I)
  9. Click the button with the green plus sign and add the "workspace" path to your folder "include" that you copied into the project folder.
  10. MinGW C++ Linker > Libraries.
  11. Go to Libraries (-l) and add: "glew32", "glfw", "glu32", "opengl32".
  12. These need to be in a proper order to try to keep them in the order I just described, from the top to the bottom (glew32 on top, then glfw, then...).
  13. Go to Library search path (-L)
  14. Add the "workspace" path to the "lib" folder you copied into the project folder.
  15. Click "Apply" and "Ok".
  16. Take the .dll's you copied into your "bin" folder and copy them into the project's "debug" or "release" folder. I use "debug", and it's what I've confirmed to work, so copy them into the "debug" folder.
  17. Copy and paste the code here over the hello world code. This will run the spinning cube dude:   http://pastebin.com/yXDzXPYq
  18. Right click the project and "Build" (or hit the hammer button up top).
  19. Right click the project and "Run As" > "Local C/C++ Application".
The GLFW project will build fine but for me I have to run it from the project's debug folder. You can of course run it in debug in the editor just fine.

Here is a copy of my project folders. Everything is referenced from within the project workspaces so things should be portable: THE_PROJECTS.

No comments:

Post a Comment