[gl2ps] link problem

Gianluca Antonelli antonelli at unicas.it
Wed Oct 11 14:32:13 CEST 2006


Hi,

I'm sorry for the very basic question about usage of the gl2ps package.

I can not link, I'm receiving an error of:

error LNK2001: unresolved external symbol

that clearly means that the linker is not finding the commands. It seems 
that I'm missing the dll and the lib files.

Below I report all the details. Thanks an advance for any reply,
Gianluca

I'm using Visual C++ 6.0 under WXP-PRO. Here is my main.cpp and the 
linker outout

--------------------
#define SizeX 600
#define SizeY 600
#define Hull_Length 5
#define Hull_Radius 0.5
#define Fore_Length 1.5


#include <stdio.h>
#include <string.h>
#include <gl/glut.h>
#include "gl2ps.h"


// Function Declarations
void Display();
void reshape(int w, int h);
void init();
void myPrintString(void *font,char *str);
void myFrame(float pos[3]);

// global variables
GLfloat light_pos[4] = {-1,1,1,0};
GLfloat frame0_pos[3] = {-3,0,0};
GLfloat frame1_pos[3] = {0,1.1,0};


/* ---------------
   MAIN
--------------- */
void main(int argc, char** argv) {

   // per gl2ps
   FILE *fp = fopen("MyFile", "wb");
   GLint buffsize = 0, state = GL2PS_OVERFLOW;
   GLint viewport[4];
   glGetIntegerv(GL_VIEWPORT, viewport);
   // fine
 
   glutInit(&argc, argv);
   glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
   glutInitWindowSize(SizeX,SizeX);
   glutInitWindowPosition((int)(1024-SizeX)/2,(int)(768-SizeX)/2);
   glutCreateWindow("ciao");
   glutReshapeFunc(reshape);

   // gl2ps
   while( state == GL2PS_OVERFLOW ){
      buffsize += 1024*1024;
      gl2psBeginPage ( "MyTitle", "MySoftware", viewport,
         GL2PS_EPS, GL2PS_BSP_SORT, GL2PS_SILENT |
         GL2PS_SIMPLE_LINE_OFFSET | GL2PS_NO_BLENDING |
         GL2PS_OCCLUSION_CULL | GL2PS_BEST_ROOT,
         GL_RGBA, 0, NULL, 0, 0, 0, buffsize, fp, "MyFile" );
      glutDisplayFunc(Display);
   state = gl2psEndPage();
}
fclose(fp);
// fine
     
   init();
   glutMainLoop();

}

/* ---------------
--------------- */
void Display() {

   GLUquadricObj *mycylinder, *mysphere, *mybottom;
   char msg[64];

   // clear window
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

   glMatrixMode (GL_MODELVIEW);                  
   glLoadIdentity();                       
   gluLookAt (-1.0, 1, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);  

   // hull/cylinder
   mycylinder = gluNewQuadric();
   gluQuadricDrawStyle(mycylinder, GLU_FILL);
   glPushMatrix();        
   glTranslatef(0,0,-Hull_Length/2.0);
   gluCylinder(mycylinder,Hull_Radius,Hull_Radius,Hull_Length,20,10);
   glPopMatrix();

   // aft/sphere
   mysphere = gluNewQuadric();
   gluQuadricDrawStyle(mysphere, GLU_FILL);
   glPushMatrix();        
   glTranslatef(0,0,Hull_Length/2.0);
   gluSphere(mysphere,Hull_Radius,20,20);
   glPopMatrix();

   // bottom/cylinder
   mybottom = gluNewQuadric();
   //gluQuadricDrawStyle(mybottom, GLU_FILL);
   gluQuadricNormals(mybottom, GLU_FLAT);
   glPushMatrix();        
   glTranslatef(0,0,-Hull_Length/2.0-Fore_Length);
   gluCylinder(mybottom,.1,Hull_Radius,Fore_Length,20,10);
   glPopMatrix();

   // inertial frame
   myFrame(frame0_pos);

   // body-fixed frame
   myFrame(frame1_pos);

   // text
   glPushMatrix();                              
//   glColor3f(0,0,0);                     
   sprintf(msg,"some text");                           
   glRasterPos3f(0,3,0);                     
   myPrintString(GLUT_BITMAP_HELVETICA_18,msg);
   glPopMatrix();

   //glFlush();
   glutSwapBuffers();

}

/* ---------------
--------------- */
void reshape(int w, int h) {

   glViewport(0, 0, w, h);
   glMatrixMode(GL_PROJECTION);
   glLoadIdentity();
   glOrtho(-5.0, 5.0, -5.0, 5.0, -5.0, 5.0);

}


/* ---------------
--------------- */
void init() {

   glClearColor(1,1,1,1);
   glEnable(GL_DEPTH_TEST);
   glEnable(GL_LIGHTING);
   glEnable(GL_LIGHT0);
   glLightfv(GL_LIGHT0, GL_POSITION, light_pos);
}


/* ---------------
--------------- */
void myPrintString(void *font,char *str) {

   int i,l=strlen(str);
  
   for(i=0;i<l;i++)
      glutBitmapCharacter(font,*str++);

}

void myFrame(float pos[3]) {

   GLUquadricObj *mycone;
   float cone_base = 0.05;
   float cone_high = 0.2;


   glPushMatrix();        
   glTranslatef(pos[0],pos[1],pos[2]);
   glBegin(GL_LINES);
     glVertex3f(0,0,0);
     glVertex3f(0,0,1);
     glVertex3f(0,0,0);
     glVertex3f(0,1,0);
     glVertex3f(0,0,0);
     glVertex3f(1,0,0);
   glEnd();

   // arrows heads
   mycone = gluNewQuadric();
   gluQuadricNormals(mycone, GLU_FLAT);
   glPushMatrix();        
     glTranslatef(0,0,1-cone_high);
     gluCylinder(mycone,cone_base,0,cone_high,20,10);
   glPopMatrix();
   glPushMatrix();
     glTranslatef(0,1-cone_high,0);
     glRotated(-90,1,0,0);
     gluCylinder(mycone,cone_base,0,cone_high,20,10);
   glPopMatrix();
   glPushMatrix();        
     glTranslatef(1-cone_high,0,0);
     glRotated(90,0,1,0);
     gluCylinder(mycone,cone_base,0,cone_high,20,10);
   glPopMatrix();

   // text
   glRasterPos3f(0,0,1.1);                     
   myPrintString(GLUT_BITMAP_HELVETICA_18,"z");
   glRasterPos3f(0,1.1,0);                     
   myPrintString(GLUT_BITMAP_HELVETICA_18,"y");
   glRasterPos3f(1.1,0,0);                     
   myPrintString(GLUT_BITMAP_HELVETICA_18,"x");
   glPopMatrix();

}
---------------------------

--------------------Configuration: main - Win32 Debug--------------------
Linking...
main.obj : error LNK2001: unresolved external symbol _gl2psEndPage
main.obj : error LNK2001: unresolved external symbol _gl2psBeginPage
Debug/main.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.

main.exe - 3 error(s), 0 warning(s)

-------------------------------

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.geuz.org/pipermail/gl2ps/attachments/20061011/3c9ef6c0/attachment.html>