openGL confusing error

Started by
5 comments, last by AndyEsser 16 years, 9 months ago
Hi I will be very thankfull if someone helps me I have written a code and used some functions but i face the following errors in microsoft visual C++ I have used these functions: tkExposeFunc(expose); tkReshapeFunc(reshape); tkDisplayFunc(draw); tkExec(); I have included these headers into my source code : #include "stdafx.h" #include <stdlib.h> #include <stdio.h> #include <windows.h> #include <glu.h> #include <glut.h> #include <glaux.h> #include <math.h> and i face these errors : DigitRendering.obj : error LNK2001: unresolved external symbol _tkExec DigitRendering.obj : error LNK2001: unresolved external symbol _tkDisplayFunc DigitRendering.obj : error LNK2001: unresolved external symbol _tkReshapeFunc DigitRendering.obj : error LNK2001: unresolved external symbol _tkExposeFunc DigitRendering.obj : error LNK2001: unresolved external symbol _tkQuit DigitRendering.obj : error LNK2001: unresolved external symbol _tkInitWindow what should I do?
Advertisement
It is not an OpenGL error as those are not OpenGL functions. You need to link with whatever library the tk* functions live in.
"When you die, if you get a choice between going to regular heaven or pie heaven, choose pie heaven. It might be a trick, but if it's not, mmmmmmm, boy."
How to Ask Questions the Smart Way.
These functions are included in gltk.h

extern void tkExec(void);
extern void tkExposeFunc(void (*)(int, int));
extern void tkReshapeFunc(void (*)(int, int));
extern void tkDisplayFunc(void (*)(void));
extern void tkKeyDownFunc(GLenum (*)(int, GLenum));
extern void tkMouseDownFunc(GLenum (*)(int, int, GLenum));
extern void tkMouseUpFunc(GLenum (*)(int, int, GLenum));
extern void tkMouseMoveFunc(GLenum (*)(int, int, GLenum));
extern void tkIdleFunc(void (*)(void));



why this happens?
The library in question is probably gltk, an OpenGL interface for Tk. You have likely been trying to compile someone's tutorial code, but you do not have gltk installed (ie, like the poster above said, you need to link your object code to gltk.o or gltk.lib or whatever it's called. Just having the header file is not enough). Replace the gltk specific code with normal windowing code or with glut, and you'll be okay.
you mean that it is better for me to use glut functions instead of gltk ones?
I don't know if it's better to use glut, just saying that it's an alternative if you can't get this gltk thing to work (it doesn't seem to be very popular, I could barely find anything about it). You can also use none of them and just write window code in the operating system's sdk, since my understanding is that glut and gltk basically just wrap window creation code and such.
You said that those functions come from gltk.h but you haven't included that at the top. Try including it and it should go away.

This topic is closed to new replies.

Advertisement