link error with WGL_ARB_render_texture

Hi,
When I try to initialize the WGL_ARB_render_texture extension functions I get a “unresolved external symbol” link error for the three function:

error LNK2001: unresolved external symbol “int (stdcall* wglSetPbufferAttribARB)(struct HPBUFFERARB *,int const )" (?wglSetPbufferAttribARB@@3P6GHPAUHPBUFFERARB__@@PBH@ZA)
error LNK2001: unresolved external symbol "int (__stdcall
wglReleaseTexImageARB)(struct HPBUFFERARB__ ,int)" (?wglReleaseTexImageARB@@3P6GHPAUHPBUFFERARB__@@H@ZA)
error LNK2001: unresolved external symbol "int (__stdcall
wglBindTexImageARB)(struct HPBUFFERARB__ *,int)” (?wglBindTexImageARB@@3P6GHPAUHPBUFFERARB__@@H@ZA)

I get the same for wglGetExtensionsStringARB. I don’t get any error for the WGL_ARB_pbuffer and WGL_ARB_pixel_format functions. What am I doing wrong?

Thanks,
Shlomi

You shouldn’t be getting a linking error with a dll entry point.
If you’ve declared wglWhatever as a static member in a class, make sure you repeat the declaration at the top of the .cpp file of that class. Like this:-

In your MYCLASS.H file:-

class MyClass
{
static WGLWHATEVER_FUNCPTR wglWhatever;
};

Now in your MYCLASS.CPP file:-

WGLWHATEVER_FUNCPTR MyClass::wglWhatever=0;

I declare the entries as extern in a header file like all other extensions entry points…

Shlomi

If you want to have global functions (global function pointers actually)

you should make a .h file and you declare them as extern

extern PFNGLACTIVETEXTUREARBPROC glActiveTextureARB;

and in your .cpp file you define it

PFNGLACTIVETEXTUREARBPROC glActiveTextureARB=NULL;

and you also have to initialize them pointers of course…

Im guessing you took a short cut in your previous projects and you didn’t get into trouble then.

Just put
#include <GL/myglextension.h> in your projects

V-man

I know I have to declare the global functions in a cpp and in an header file as well, but (for some reason) I never done that for the opengl extensions entry points, and it always worked just fine.

I declared the functions’ pointers in a cpp and now it works, but I still don’t know why the other extensions entry points doesn’t need to be declared in a cpp.

Originally posted by Quaternion:
I declared the functions’ pointers in a cpp and now it works, but I still don’t know why the other extensions entry points doesn’t need to be declared in a cpp.

Maybe because you never call them?

of course I call them…

never mind, it works now. One more thing, Do the latest nVidia drivers support WGL_ARB_render_texture? It doesn’t appear in my WGL extensions list.

Shlomi