[SOLVED] How to use glut in my shared library
-
Hi everyone, I got a problem with using glut in my shared library. Please help me!
I'm developing an application that draws 3D solid in a QWidget, I use glut library to initial, draw and so on... And the app works with no problem, but after a month, I realize bulding entire app is too slow, it take about 15 minutes for 1 build, so I decided to break my app into separate libraries to reduce the building time.
It's ok with libraries doesn't include glut, but with glut included in my library, it can't compile, with
@
error: undefined reference toglBegin@4' error: undefined reference to
glVertex3f@12'
error: undefined reference to `glEnd@0'
@
Here is my library project:
util.pro file:@
LIBS += -L./lib -lglut32 #glut.lib, glut32.lib, libglut32.a here
INCLUDEPATH += ./include #glut.h file hereTARGET = util
TEMPLATE = libSOURCES += draw.cpp
HEADERS += draw.h
@
Here is draw.h file:
@
void drawLine(float x1, float y1, float z1, float x2, float y2, float z2);
@
And draw.cpp file:
@
#include <glut.h>
#include "draw.h"
void drawLine(float x1, float y1, float z1, float x2, float y2, float z2){
glBegin(GL_LINES);
glVertex3f(x1,y1,z1);
glVertex3f(x2,y2,z2);
glEnd();
}
@
I also try to use static library but it isn't work either.
So how to use glut with static or shared library? Is it posible with qt?Any suggest will be appreciated!
[Edit: Added @ tags for code formatting -- mlong]
-
Thanks rcari & Don Harris so much!
Finally, I can use glut in my library with your help.