<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#c8c8c8" text="#000099">
Hi,<br>
<br>
I'm sorry for the very basic question about usage of the gl2ps package.<br>
<br>
I can not link, I'm receiving an error of:<br>
<br>
error LNK2001: unresolved external symbol<br>
<br>
that clearly means that the linker is not finding the commands. It
seems that I'm missing the dll and the lib files.<br>
<br>
Below I report all the details. Thanks an advance for any reply,<br>
Gianluca<br>
<br>
I'm using Visual C++ 6.0 under WXP-PRO. Here is my main.cpp and the
linker outout<br>
<br>
--------------------<br>
#define SizeX 600<br>
#define SizeY 600<br>
#define Hull_Length 5<br>
#define Hull_Radius 0.5<br>
#define Fore_Length 1.5<br>
<br>
<br>
#include <stdio.h><br>
#include <string.h><br>
#include <gl/glut.h><br>
#include "gl2ps.h"<br>
<br>
<br>
// Function Declarations<br>
void Display();<br>
void reshape(int w, int h);<br>
void init();<br>
void myPrintString(void *font,char *str);<br>
void myFrame(float pos[3]);<br>
<br>
// global variables<br>
GLfloat light_pos[4] = {-1,1,1,0};<br>
GLfloat frame0_pos[3] = {-3,0,0};<br>
GLfloat frame1_pos[3] = {0,1.1,0};<br>
<br>
<br>
/* ---------------<br>
MAIN<br>
--------------- */<br>
void main(int argc, char** argv) {<br>
<br>
// per gl2ps<br>
FILE *fp = fopen("MyFile", "wb");<br>
GLint buffsize = 0, state = GL2PS_OVERFLOW;<br>
GLint viewport[4];<br>
glGetIntegerv(GL_VIEWPORT, viewport);<br>
// fine<br>
<br>
glutInit(&argc, argv);<br>
glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);<br>
glutInitWindowSize(SizeX,SizeX);<br>
glutInitWindowPosition((int)(1024-SizeX)/2,(int)(768-SizeX)/2);<br>
glutCreateWindow("ciao");<br>
glutReshapeFunc(reshape);<br>
<br>
// gl2ps<br>
while( state == GL2PS_OVERFLOW ){<br>
buffsize += 1024*1024;<br>
gl2psBeginPage ( "MyTitle", "MySoftware", viewport,<br>
GL2PS_EPS, GL2PS_BSP_SORT, GL2PS_SILENT |<br>
GL2PS_SIMPLE_LINE_OFFSET | GL2PS_NO_BLENDING |<br>
GL2PS_OCCLUSION_CULL | GL2PS_BEST_ROOT,<br>
GL_RGBA, 0, NULL, 0, 0, 0, buffsize, fp, "MyFile" );<br>
glutDisplayFunc(Display);<br>
state = gl2psEndPage();<br>
}<br>
fclose(fp);<br>
// fine<br>
<br>
init();<br>
glutMainLoop();<br>
<br>
}<br>
<br>
/* ---------------<br>
--------------- */<br>
void Display() {<br>
<br>
GLUquadricObj *mycylinder, *mysphere, *mybottom;<br>
char msg[64];<br>
<br>
// clear window<br>
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); <br>
<br>
glMatrixMode (GL_MODELVIEW); <br>
glLoadIdentity(); <br>
gluLookAt (-1.0, 1, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); <br>
<br>
// hull/cylinder<br>
mycylinder = gluNewQuadric();<br>
gluQuadricDrawStyle(mycylinder, GLU_FILL);<br>
glPushMatrix(); <br>
glTranslatef(0,0,-Hull_Length/2.0);<br>
gluCylinder(mycylinder,Hull_Radius,Hull_Radius,Hull_Length,20,10);<br>
glPopMatrix();<br>
<br>
// aft/sphere<br>
mysphere = gluNewQuadric();<br>
gluQuadricDrawStyle(mysphere, GLU_FILL);<br>
glPushMatrix(); <br>
glTranslatef(0,0,Hull_Length/2.0);<br>
gluSphere(mysphere,Hull_Radius,20,20);<br>
glPopMatrix();<br>
<br>
// bottom/cylinder<br>
mybottom = gluNewQuadric();<br>
//gluQuadricDrawStyle(mybottom, GLU_FILL);<br>
gluQuadricNormals(mybottom, GLU_FLAT);<br>
glPushMatrix(); <br>
glTranslatef(0,0,-Hull_Length/2.0-Fore_Length);<br>
gluCylinder(mybottom,.1,Hull_Radius,Fore_Length,20,10);<br>
glPopMatrix();<br>
<br>
// inertial frame<br>
myFrame(frame0_pos);<br>
<br>
// body-fixed frame<br>
myFrame(frame1_pos);<br>
<br>
// text<br>
glPushMatrix(); <br>
// glColor3f(0,0,0); <br>
sprintf(msg,"some text"); <br>
glRasterPos3f(0,3,0); <br>
myPrintString(GLUT_BITMAP_HELVETICA_18,msg); <br>
glPopMatrix();<br>
<br>
//glFlush();<br>
glutSwapBuffers();<br>
<br>
}<br>
<br>
/* ---------------<br>
--------------- */<br>
void reshape(int w, int h) {<br>
<br>
glViewport(0, 0, w, h);<br>
glMatrixMode(GL_PROJECTION);<br>
glLoadIdentity();<br>
glOrtho(-5.0, 5.0, -5.0, 5.0, -5.0, 5.0);<br>
<br>
}<br>
<br>
<br>
/* ---------------<br>
--------------- */<br>
void init() {<br>
<br>
glClearColor(1,1,1,1);<br>
glEnable(GL_DEPTH_TEST);<br>
glEnable(GL_LIGHTING);<br>
glEnable(GL_LIGHT0);<br>
glLightfv(GL_LIGHT0, GL_POSITION, light_pos);<br>
}<br>
<br>
<br>
/* ---------------<br>
--------------- */<br>
void myPrintString(void *font,char *str) {<br>
<br>
int i,l=strlen(str);<br>
<br>
for(i=0;i<l;i++)<br>
glutBitmapCharacter(font,*str++);<br>
<br>
}<br>
<br>
void myFrame(float pos[3]) {<br>
<br>
GLUquadricObj *mycone;<br>
float cone_base = 0.05;<br>
float cone_high = 0.2;<br>
<br>
<br>
glPushMatrix(); <br>
glTranslatef(pos[0],pos[1],pos[2]);<br>
glBegin(GL_LINES);<br>
glVertex3f(0,0,0);<br>
glVertex3f(0,0,1);<br>
glVertex3f(0,0,0);<br>
glVertex3f(0,1,0);<br>
glVertex3f(0,0,0);<br>
glVertex3f(1,0,0);<br>
glEnd();<br>
<br>
// arrows heads<br>
mycone = gluNewQuadric();<br>
gluQuadricNormals(mycone, GLU_FLAT);<br>
glPushMatrix(); <br>
glTranslatef(0,0,1-cone_high);<br>
gluCylinder(mycone,cone_base,0,cone_high,20,10);<br>
glPopMatrix();<br>
glPushMatrix();<br>
glTranslatef(0,1-cone_high,0);<br>
glRotated(-90,1,0,0);<br>
gluCylinder(mycone,cone_base,0,cone_high,20,10);<br>
glPopMatrix();<br>
glPushMatrix(); <br>
glTranslatef(1-cone_high,0,0);<br>
glRotated(90,0,1,0);<br>
gluCylinder(mycone,cone_base,0,cone_high,20,10);<br>
glPopMatrix();<br>
<br>
// text<br>
glRasterPos3f(0,0,1.1); <br>
myPrintString(GLUT_BITMAP_HELVETICA_18,"z"); <br>
glRasterPos3f(0,1.1,0); <br>
myPrintString(GLUT_BITMAP_HELVETICA_18,"y"); <br>
glRasterPos3f(1.1,0,0); <br>
myPrintString(GLUT_BITMAP_HELVETICA_18,"x"); <br>
glPopMatrix();<br>
<br>
}<br>
<font face="Courier New, Courier, monospace">---------------------------<br>
<br>
--------------------Configuration: main - Win32
Debug--------------------<br>
Linking...<br>
main.obj : error LNK2001: unresolved external symbol _gl2psEndPage<br>
main.obj : error LNK2001: unresolved external symbol _gl2psBeginPage<br>
Debug/main.exe : fatal error LNK1120: 2 unresolved externals<br>
Error executing link.exe.<br>
<br>
main.exe - 3 error(s), 0 warning(s)<br>
<br>
-------------------------------<br>
<br>
</font>
</body>
</html>