Before I continue, go into terminal and type in:
"man make"
"man g++"
"man manuals are not found you NEED to upgrade Xcode! (I have no idea how you got MacPorts to work if you have not done this already)
Xcode is about 2.5gB, so it will take a while. But the upgrade is really nice (at least in my opinion). But it is needed for MacPorts.
Next, I will go over all the wrong steps.
MacPorts is a really nice tool, but you will NOT need it to install OpenGL and GLUT. It uses the "port" command from Terminal. Such as: "sudo port install cmake", which installs cmake. I tried installing glut though MacPorts, but it did not help. So I tried installing it manually from a zip file. Which include files are located (from what I currently know of) in two spots on the computer: "/opt/local/include/" and "/usr/local/include". I dragged and dropped some files in there (as well as some "Allegro" files, which is another library. I will be going over "Allegro" for a little bit in here since it also messed me up. I copied .../Allegro5/* into the include folders, but I really needed to copy .../* of the zip into the folder (leaving the Allegro5 folder intact though the copy). This left conflicting packages (ie. Memory.h!). Allegro needed to install something in "/Allegro5/platform/". (try to compile with #include
So what should you do?
NOTHING! Thats right, nothing! It is ALREADY INSTALLED ON MACS!!! Lucky you!
But to use it the right way you need to:
Use the right includes:
#include <OpenGL/OpenGL.h>
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#include <GLUT/glut.h>
Terminal users:
g++ main.cpp -o main -framework GLUT -framework OpenGL
gcc main.c -o main -framework GLUT -framework OpenGL
make is the same way
Xcode users:
Right click project in the "Groups & Files" bar (left side)
Add
Existing Frameworks...
Select Glut and OpenGl
You should see them added with your project
No comments:
Post a Comment