Jump to content
• Advertisement

# glWindowPos2i in C++

This topic is 4703 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

## Recommended Posts

Not too long ago I've been suggested here to use glWindowPos to locate texts, because they needed to be displayed even when they were partly out of the screen. It worked fine. However now, on a new project, I'm using C++ instead of C. But now I can't get it to work. I use the following code to test it: #include <GL/gl.h> #include <GL/glu.h> #include <GL/glx.h> #include <SDL/SDL.h> int main() { glWindowPos2i(800, 600); } (I know this wouldn't work if it compiled) But my problem is, it doesn't even compile. Here's what I tried: $gcc -l m -l GL -l GLU test.c$ (Works fine with gcc) However with g++: $g++ -l m -l GL -l GLU test.c test.c: In function int main()': test.c:9: error: glWindowPos2i' undeclared (first use this function) test.c:9: error: (Each undeclared identifier is reported only once for each function it appears in.)$ Even when I prototype it manually: $g++ -l m -l GL -l GLU test.c /tmp/ccKzzuv0.o: In function main': test.c:(.text+0xf): undefined reference to glWindowPos2i(int, int)' collect2: ld returned 1 exit status$ Any idea on how I can use glWindowPos2i anyway? Thanks in advance

#### Share this post

##### Share on other sites
Advertisement
It's an extension. So glWindowPos2i is actually a function pointer rather than an external referance resolved by the linker. The FAQ on here lists a couple of libraries that will declare the pointers and set them for you. glext.h defines the data types for the function pointers, i.e. the parameters. As an example for glWindowPos2i it is PFNGLWINDOWPOS2IPROC. Under windows you would call wglGetProcAddress to set the pointer and I assume under X Windows it would be glxGetProcAddress. Easiest is to just use one of the libraries above.

#### Share this post

##### Share on other sites

• Advertisement
• Advertisement

• ### Popular Contributors

1. 1
Rutin
46
2. 2
3. 3
4. 4
5. 5
• Advertisement

• 11
• 9
• 12
• 10
• 13
• ### Forum Statistics

• Total Topics
632988
• Total Posts
3009737
• ### Who's Online (See full list)

There are no registered users currently online

×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!