3

I cannot get GLEW to link correctly with my program.

I have the path correct in my project (I've triple checked), I have tried building from scratch, using the x86 libs (all 4 - the -s, -mxs, etc) AND the x64 libs.

I have tried using the #pragma directive instead of configuring my project in properties.

I am trying to get it as a static lib so no DLLs will be necessary.

I also have GLEW_STATIC defined, as the build instructions advise.

Error message:

OGLInit.obj : error LNK2019: unresolved external symbol _glewInit@0 referenced in function "bool __stdcall vexal::OGLStartup(void)" (?OGLStartup@vexal@@YG_NXZ)

I've even used dumpbin to check that initGlew is there. It is, and it is external.

I've also verified it's found the lib.

Searching C:\Users\Jake\Documents\Vexal2\vexal\vc9_x86\lib\Debug\GLEW.lib:

I've run out of ideas here. Any help?

genpfault
  • 51,148
  • 11
  • 85
  • 139
Qix - MONICA WAS MISTREATED
  • 14,451
  • 16
  • 82
  • 145

2 Answers2

1

Yep. I rebuilt it using the glew_static project.

Just because you built that project doesn't mean you're linking to it.

C:\Users\Jake\Documents\Vexal2\vexal\vc9_x86\lib\Debug\GLEW.lib

That is not the static GLEW library. That is the import library for the DLL version of GLEW. The static GLEW library is called GLEW32s.lib. Link to that.

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
  • Alright, made those libraries. Added the DLL not only to the solution dir, but to the project dir and the Debug dir as well. Still getting the same error. – Qix - MONICA WAS MISTREATED Feb 08 '12 at 16:21
  • You're supposed to *not* be linking to the DLL. You're building the *static* GLEW, not the DLL version. If you want to use GLEW as a DLL, you have to take out your `GLEW_STATIC` definition. – Nicol Bolas Feb 08 '12 at 16:24
  • That's what I've been doing _-_ I defined GLEW_STATIC in the project and built, which yielded GLEW.lib (which is what I told it to make). – Qix - MONICA WAS MISTREATED Feb 08 '12 at 16:30
1

The problem was the calling convention. I changed the calling convention settings to __stdcall instead of __cdecl, changed _glfwTerminate_atexit( void ) to __cdecl in the GLFW code I had, and then built.

Fixed!

Qix - MONICA WAS MISTREATED
  • 14,451
  • 16
  • 82
  • 145