PDA

View Full Version : glut installed won't complie



Fuzzy
05-07-2008, 09:57 PM
Ok, here's the deal. I'm a registered developer on mac's site. I upgraded from 2.1 to 2.5 and I'm using Mac 10.4.11. I'm using an old G4 Laptop that's a 1 gig hertz. Leopard won't run on it I've tried.

Every time I try to complie GCC and xcode aren't seeing glut. I'm not getting open error just glut. I've checked my install of xcode. glut framework is in fact there. I'm not really sure what's up. I'm know it's glut. Cause that code complies just fine on windows. Anyone have some ideas on who to fix this.???

error messages:

Building target “window” of project “window” with configuration “Debug” — (11 errors)
cd /Users/Fuzzy/Documents/window
/Developer/usr/bin/gcc-4.0 -x c++ -arch ppc -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks -g -O0 -Wreturn-type -Wunused-variable -fmessage-length=0 -mtune=G5 -mfix-and-continue -mmacosx-version-min=10.4 -fvisibility-inlines-hidden -I/Users/Fuzzy/Documents/window/build/window.build/Debug/window.build/window.hmap -F/Users/Fuzzy/Documents/window/build/Debug -I/Users/Fuzzy/Documents/window/build/Debug/include -I/Users/Fuzzy/Documents/window/build/window.build/Debug/window.build/DerivedSources -isysroot /Developer/SDKs/MacOSX10.4u.sdk -c /Users/Fuzzy/Documents/window/main.cpp -o /Users/Fuzzy/Documents/window/build/window.build/Debug/window.build/Objects-normal/ppc/main.o
/Users/Fuzzy/Documents/window/main.cpp: In function 'void RenderScene()':
/Users/Fuzzy/Documents/window/main.cpp:5: error: 'GL_COLOR_BUFFER_BIT' was not declared in this scope
/Users/Fuzzy/Documents/window/main.cpp:5: error: 'glClear' was not declared in this scope
/Users/Fuzzy/Documents/window/main.cpp:6: error: 'glFlush' was not declared in this scope
/Users/Fuzzy/Documents/window/main.cpp: In function 'void SetupRC()':
/Users/Fuzzy/Documents/window/main.cpp:11: error: 'glClearColor' was not declared in this scope
/Users/Fuzzy/Documents/window/main.cpp: In function 'int main(int, char**)':
/Users/Fuzzy/Documents/window/main.cpp:18: error: 'glutInit' was not declared in this scope
/Users/Fuzzy/Documents/window/main.cpp:19: error: 'GLUT_SINGLE' was not declared in this scope
/Users/Fuzzy/Documents/window/main.cpp:19: error: 'GLUT_RGBA' was not declared in this scope
/Users/Fuzzy/Documents/window/main.cpp:19: error: 'glutInitDisplayMode' was not declared in this scope
/Users/Fuzzy/Documents/window/main.cpp:20: error: 'glutCreateWindow' was not declared in this scope
/Users/Fuzzy/Documents/window/main.cpp:21: error: 'glutDisplayFunc' was not declared in this scope
/Users/Fuzzy/Documents/window/main.cpp:24: error: 'glutMainLoop' was not declared in this scope
/Users/Fuzzy/Documents/window/main.cpp:5: error: 'GL_COLOR_BUFFER_BIT' was not declared in this scope
/Users/Fuzzy/Documents/window/main.cpp:5: error: 'glClear' was not declared in this scope
/Users/Fuzzy/Documents/window/main.cpp:6: error: 'glFlush' was not declared in this scope
/Users/Fuzzy/Documents/window/main.cpp:11: error: 'glClearColor' was not declared in this scope
/Users/Fuzzy/Documents/window/main.cpp:18: error: 'glutInit' was not declared in this scope
/Users/Fuzzy/Documents/window/main.cpp:19: error: 'GLUT_SINGLE' was not declared in this scope
/Users/Fuzzy/Documents/window/main.cpp:19: error: 'GLUT_RGBA' was not declared in this scope
/Users/Fuzzy/Documents/window/main.cpp:19: error: 'glutInitDisplayMode' was not declared in this scope
/Users/Fuzzy/Documents/window/main.cpp:20: error: 'glutCreateWindow' was not declared in this scope
/Users/Fuzzy/Documents/window/main.cpp:21: error: 'glutDisplayFunc' was not declared in this scope
/Users/Fuzzy/Documents/window/main.cpp:24: error: 'glutMainLoop' was not declared in this scope
Build failed (11 errors)

OneSadCookie
05-08-2008, 10:31 PM
You need to stick a #include <GLUT/glut.h> at the top of main.cpp

Fuzzy
05-09-2008, 01:35 PM
I'm affraid I've got that covered.

Custom header file:

// Windows
#ifdef WIN32
#include <windows.h>
#include <iostream>
#include <math.h>
#include <glee.h>
#include <gl/gl.h>

#include <gl/glu.h>
#include <glut.h>
#endif

// Mac Os X
#ifdef _APPLE_
#include <Carbon/Carbon.h>
#include <iostream>
#include <math.h>
#include <glee.h>
#include <OpenGL/gl.h>

#include <OpenGL/glu.h>
#include <GLUT/glut.h>
#endif

using namespace std;

Here is my include on the cpp page. I've tried this on g++ as well. I can't do it either way. It's rather madening.

window.cpp file


#include "opengl.h" // Custom open GL header

void RenderScene(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glFlush();
}

void SetupRC(void)
{
glClearColor(0.0f, 0.0F, 1.0f, 1.0f);
}

// Main

int main(int argc, char* argv[])
{
glutInit(&amp;argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGBA);
glutCreateWindow("Project V window test");
glutDisplayFunc(RenderScene);
SetupRC();

glutMainLoop();

return 0;
}

Fuzzy
05-09-2008, 01:41 PM
It seems to be me like glut isn't linked to gcc at all. So i'm wondering if anyone knows how to link in Gcc with glut. I have xcode installed but I'm not really a big fan. However, even when I use xcode I get the same errors. It's rather madening. I'm sure it's great once you get use to it. I'm a more of a terminal window guy. I complied this on Ms Windows and now I'm seeing how portal opengl really is. Hence the custom header file.

I'm use to using linux <Red Hat> but some commands don't cross over between darwin and Linux. I've never been that strong in recreating dynamic links between libraries.

OneSadCookie
05-10-2008, 11:09 AM
_APPLE_ won't be defined. Check for __APPLE__ instead.