Does Not Compile on Solaris 8
When ever I compile my program, I get this:
billnic[root]:/home/bblair/programs/myOpenGL> gcc glut2.cpp
Undefined first referenced
symbol in file
glutInitWindowPosition /var/tmp/ccva0XrQ.o
glTranslatef /var/tmp/ccva0XrQ.o
glutSwapBuffers /var/tmp/ccva0XrQ.o
glutCreateWindow /var/tmp/ccva0XrQ.o
glutMainLoop /var/tmp/ccva0XrQ.o
glViewport /var/tmp/ccva0XrQ.o
sunOglCurrentContext /var/tmp/ccva0XrQ.o
glMatrixMode /var/tmp/ccva0XrQ.o
glShadeModel /var/tmp/ccva0XrQ.o
glutDisplayFunc /var/tmp/ccva0XrQ.o
glPopMatrix /var/tmp/ccva0XrQ.o
sunOglCurPrimTablePtr /var/tmp/ccva0XrQ.o
glutReshapeFunc /var/tmp/ccva0XrQ.o
glHint /var/tmp/ccva0XrQ.o
glClear /var/tmp/ccva0XrQ.o
glutInitDisplayMode /var/tmp/ccva0XrQ.o
glClearColor /var/tmp/ccva0XrQ.o
gluLookAt /var/tmp/ccva0XrQ.o
glBegin /var/tmp/ccva0XrQ.o
glEnd /var/tmp/ccva0XrQ.o
glFlush /var/tmp/ccva0XrQ.o
glutInitWindowSize /var/tmp/ccva0XrQ.o
glLoadIdentity /var/tmp/ccva0XrQ.o
glutIdleFunc /var/tmp/ccva0XrQ.o
gluPerspective /var/tmp/ccva0XrQ.o
glPushMatrix /var/tmp/ccva0XrQ.o
glClearDepth /var/tmp/ccva0XrQ.o
glEnable /var/tmp/ccva0XrQ.o
glutInit /var/tmp/ccva0XrQ.o
glDepthFunc /var/tmp/ccva0XrQ.o
glRotatef /var/tmp/ccva0XrQ.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status
billnic[root]:/home/bblair/programs/myOpenGL>
And my program is this:#include
#include
#include
#include
#include
#include
/* For use with Solaris */
#include
#include
#include
// User Defined Variables for the
// inverted triangle/pyramid rednering
float angle=0.0f; // Used To Rotate The Triangles
int rot1, rot2; // Counter Variables
void Resize(int w, int h) {
// Prevent a divide by zero, when window is too short
// (you cant make a window of zero width).
if(h == 0){h = 1;}
float ratio = 1.0* w / h;
// Reset the coordinate system before modifying
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
// Set the viewport to be the entire window
glViewport(0, 0, w, h);
// Set the correct perspective.
gluPerspective(45,ratio,1,1000);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0.0,0.0,5.0,
0.0,0.0,-1.0,
0.0f,1.0f,0.0f);
}
// Initial Settings for the Drawing
void InitGL(void){
/* attributes */
glShadeModel(GL_SMOOTH); // Enable Smooth Shading
glClearColor(0.0,0.0,0.0,0.5f); // Background Color Specified by the File
glClearDepth(1.0f); // Depth Buffer Setup
glEnable(GL_DEPTH_TEST); // Enables Depth Testing
glDepthFunc(GL_LEQUAL); // The Type Of Depth Testing To Do
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Really Nice Perspective Calculations
} // End InitGL();
// Draws NeHe Graphic
void DrawNeHe(void){
glLoadIdentity(); // Reset The Modelview Matrix
glTranslatef (0.0f, 0.0f, -6.0f); // Translate 6 Units Into The Screen
glRotatef (angle, 0.0f, 1.0f, 0.0f); // Rotate On The Y-Axis By angle
for (rot1=0; rot1<2; rot1++) // 2 Passes
{
glRotatef(90.0f,0.0f,1.0f,0.0f); // Rotate 90 Degrees On The Y-Axis
glRotatef(180.0f,1.0f,0.0f,0.0f); // Rotate 180 Degress On The X-Axis
for (rot2=0; rot2<2; rot2++) // 2 Passes
{
glRotatef(180.0f,0.0f,1.0f,0.0f); // Rotate 180 Degrees On The Y-Axis
glBegin (GL_TRIANGLES); // Begin Drawing Triangles
glColor3f (1.f, 0.f, 0.f); glVertex3f( 0.0f, 1.0f, 0.0f);
glColor3f (0.f, 1.f, 0.f); glVertex3f(-1.0f,-1.0f, 1.0f);
glColor3f (0.f, 0.f, 1.f); glVertex3f( 1.0f,-1.0f, 1.0f);
glEnd (); // Done Drawing Triangles
} // End Inner For
} // End Outer For
// This is where all the drawing is done
void renderScene(void) {
// Clearing the depth buffer, otherwise the depth
// buffer gets filled and nothing gets rendered
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Save the previous settings, in this case save
// we''re refering to the camera settings.
glPushMatrix();
// Drawing Code as Functions can be put here...
DrawNeHe();
// Discard the modelling transformations
// after this the matrix will have only the camera settings.
glPopMatrix();
// Be sure the graphics buffer has been sent
glFlush ();
// Swapping the buffers causes the rendering above to be shown
glutSwapBuffers();
// Finally pdate the angle for the next scene
angle+=0.5f;
} // End renderScene();
void main(int argc, char **argv) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
glutInitWindowPosition(0,0);
glutInitWindowSize(300,300);
glutCreateWindow("Glut Version of NeHe Base Code");
InitGL();
glutDisplayFunc(renderScene);
glutIdleFunc(renderScene);
glutReshapeFunc(Resize);
glutMainLoop();
} //End main();
As you can see I hard coded some of the includes, but why will it not compile? Am I forgetting something? I did everything that the Solaris Tutorial said to do... So what gives?
Please hel...
Thanks!
John William Blair
Thanks!John William Blair "The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he who, in the name of charity and good will, shepherds the weak through the valley of the darkness. For he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee."
http://members.home.com/chucklez/wtc/index.html
http://members.home.com/chucklez/wtc/index.html
For some reason the includes did not show up. Here they are again...
#include
#include
#include
#include
#include
#include
/* For use with Solaris */
#include
#include
#include
#include
#include
#include
#include
#include
#include
/* For use with Solaris */
#include
#include
#include
Thanks!John William Blair "The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he who, in the name of charity and good will, shepherds the weak through the valley of the darkness. For he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee."
http://members.home.com/chucklez/wtc/index.html
http://members.home.com/chucklez/wtc/index.html
They still did not show! Must be something with the forum, so I removed the "<"">"''s
#include math.h
#include stdio.h
#include stdlib.h
#include iostream.h
#include fstream.h
#include string.h
/* For use with Solaris */
#include /usr/local/sparc_solaris/glut-3.7/include/GL/glut.h
#include /usr/openwin/share/include/GL/glu.h
#include /usr/openwin/share/include/GL/gl.h
#include math.h
#include stdio.h
#include stdlib.h
#include iostream.h
#include fstream.h
#include string.h
/* For use with Solaris */
#include /usr/local/sparc_solaris/glut-3.7/include/GL/glut.h
#include /usr/openwin/share/include/GL/glu.h
#include /usr/openwin/share/include/GL/gl.h
Thanks!John William Blair "The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he who, in the name of charity and good will, shepherds the weak through the valley of the darkness. For he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee."
http://members.home.com/chucklez/wtc/index.html
http://members.home.com/chucklez/wtc/index.html
April 04, 2001 03:24 PM
The errors are _link_ errors. It seems like you are including the right headers but you do not link to any libraries. Perhaps something like this:
gcc glut2.cpp -lX11 -lXi -lXmu -lglut -lGL -lGLU -lm
Perhaps is it also better to use g++ instead of gcc since you are using C++.
gcc glut2.cpp -lX11 -lXi -lXmu -lglut -lGL -lGLU -lm
Perhaps is it also better to use g++ instead of gcc since you are using C++.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement