GLFW and glew linking errors with Visual Studios 2010

Simply put:

error LNK2019: unresolved external symbol _glfwSetWindowTitle referenced in function _main
error LNK2019: unresolved external symbol __imp__glewInit@0 referenced in function _main
error LNK2001: unresolved external symbol __imp__glewExperimental
error LNK2019: unresolved external symbol _glfwTerminate referenced in function _main
error LNK2019: unresolved external symbol _glfwOpenWindow referenced in function _main
....etc....

      

In linker-> input-> additional dependencies:

opengl32.lib
glfw.lib
glew32.lib
glu32.lib

      

I try everything I can think of and nothing works, so some of them might not even be needed.

Then in additional library directories I have:, $(VSInstallDir)lib; $(Path)

none of which is needed. I have library files in there and they also tried to copy them to the project directory and any subdirectory and still no dice. I am grateful for any advice or insight!

+3


source to share


3 answers


Maybe you add #define GLFW_DLL

I can reproduce the error when I added it. If you want to use the DLL version of GLFW, you must add GLFWDLL.lib.
Check the GLFW 2.7.4 Release Notes .



0


source


Not sure about the problem with GLFW, but for GLEW I had to define GLEW_STATIC.



Go to Project-> Properties-> C / C ++ → Preprocessor, then under Preprocessor Definitions add GLEW_STATIC.

0


source


I had a very similar question. I could write code at my entry point to use GLFW and GLEW to create the window, but once I draw this in a separate document (like app.hpp) and include it in my entry point, it won't compile despite being correct code.

error LNK2019: unresolved external symbol __imp__glewInit @ 0 specified in function _main error LNK2001: unresolved external symbol __imp__glewExperimental

These two errors that I got, somehow, GLEW were not properly included in my project. The real problem was the linker was not getting the documents it wanted. Namely, that I used glew32s.dll and not glew32.dll.

The immediate solution was to stop using GLEW_STATIC and use GLEW. I did the same steps below instead of using glew32.dll instead of static GLEW and it all worked fine for me.

Make sure the inclusions for GLFW and GLEW have been made in:

Properties> C / C ++> General> Additional Include Directories

Then you need to link the GLFW and GLEW libraries with:

Properties> Connector> General> Additional Library Directories

And of course, make sure you specify which DLLs you want to use (both GLFW and GLEW in this case)

Properties> Connector> Input> Additional Dependencies

Then you take both the GLFW and GLEW libraries that you just added to the additional dependencies and paste them in the folder where you specify the entry point (main.cpp).

This fixed all my problems, which was essentially a similar problem for you.

Hope this solved your problem. Pay close attention to copying these DLL files to the folder containing the entry point - this is exactly where I fell.

opengl32.lib glfw3.lib glew32s.lib glew32.lib

0


source







All Articles