I am using Code::Blocks with a MinGW compiler. These are my includes:
#ifdef __APPLE__
#include <OpenGL/OpenGL.h>
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#endif
If I try to use a function
glutMainLoopEvent();
It throws an error:
'glutMainLoopEvent' was not declared in this scope.
The function
glutMainLoop();
Works perfectly though.
If I try to include both glut and freeglut (I have correctly installed it, I made sure to watch several videos a few times carefully following the steps) like this:
#ifdef __APPLE__
#include <OpenGL/OpenGL.h>
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#include <GL/freeglut.h>
#endif
I get 24 of errors such as:
undefined reference to `_imp____glutInitWithExit@12'
undefined reference to `_imp____glutCreateWindowWithExit@8'
undefined reference to `glClearColor@16'
But these don't include the error I was getting before!! From what I can understand, I can include either glut or freeglut, but not both together. How do I figure this out? Thanks!
EDIT:
Linker options:
-lfreeglut
-lopengl32
-lglu32
Completely eliminated the problem, now it works as expected.