我已将 .dll 添加到 Windows/System32,将 .lib 添加到 VS/lib,将 .h 添加到 VS/include。
剩下的就是通过项目链接它。这就是我所拥有的:
#include <glfw.h>
int main(void)
{
/* Initialize the library */
if (!glfwInit())
return -1;
/* Create a windowed mode window and its OpenGL context */
if (!glfwOpenWindow(640, 480, 8, 8, 8, 0, 24, 0, GLFW_WINDOW))
return -1;
/* Loop until the user closes the window */
while (glfwGetWindowParam(GLFW_OPENED))
{
/* Render here */
/* Swap front and back buffers and process events */
glfwSwapBuffers();
}
return 0;
}
1>Main.obj : error LNK2019: unresolved external symbol _glfwSwapBuffers referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol _glfwGetWindowParam referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol _glfwOpenWindow referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol _glfwInit referenced in function _main
1>C:\Users\Danny\documents\visual studio 2010\Projects\OGL2\Debug\OGL2.exe : fatal error LNK1120: 4 unresolved externals
我去了项目>属性>配置属性>链接器>在附加依赖项中添加了以下内容:
opengl32.lib;GLFW.lib;glu32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
为了更好地衡量,我还将忽略所有默认库设置为“否”。
我知道我应该链接:opengl32.lib, GLFW.lib, glu32.lib, kernel32.lib and user32.lib
不幸的是,LNK 2019 问题仍然存在。真的不确定为什么。非常感谢所有帮助。