我有一个问题我在VS 2013社区版中使用GLFW而且我收到此错误:
1>------ Build started: Project: [F]Mod, Configuration: Debug Win32 ------
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>glfw3.lib(window.c.obj) : error LNK2019: unresolved external symbol __imp__glClear@4 referenced in function _glfwCreateWindow
1>glfw3.lib(context.c.obj) : error LNK2019: unresolved external symbol __imp__glGetIntegerv@8 referenced in function __glfwRefreshContextAttribs
1>glfw3.lib(context.c.obj) : error LNK2019: unresolved external symbol __imp__glGetString@4 referenced in function _glfwExtensionSupported
1>glfw3.lib(wgl_context.c.obj) : error LNK2019: unresolved external symbol __imp__wglCreateContext@4 referenced in function __glfwCreateContext
1>glfw3.lib(wgl_context.c.obj) : error LNK2019: unresolved external symbol __imp__wglDeleteContext@4 referenced in function __glfwDestroyContext
1>glfw3.lib(wgl_context.c.obj) : error LNK2019: unresolved external symbol __imp__wglGetProcAddress@4 referenced in function __glfwPlatformGetProcAddress
1>glfw3.lib(wgl_context.c.obj) : error LNK2019: unresolved external symbol __imp__wglMakeCurrent@8 referenced in function __glfwPlatformMakeContextCurrent
1>glfw3.lib(wgl_context.c.obj) : error LNK2019: unresolved external symbol __imp__wglShareLists@8 referenced in function __glfwCreateContext
1>c:\users\finn\documents\visual studio 2013\Projects\[F]Mod\Debug\[F]Mod.exe : fatal error LNK1120: 8 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
所以我尝试使用32位二进制文件而不是改变:(
编辑:是的,我的问题与this问题非常相似,Chris Dargis建议的答案(添加opengl32.lib
)不起作用,尽管它确实产生了一组不同的错误:
1>------ Build started: Project: [F]Mod, Configuration: Debug Win32 ------
1>WindowFunctions.obj : error LNK2019: unresolved external symbol _glfwTerminate referenced in function "void __cdecl WindowCreate(void)" (?WindowCreate@@YAXXZ)
1>WindowFunctions.obj : error LNK2019: unresolved external symbol _glfwCreateWindow referenced in function "void __cdecl WindowCreate(void)" (?WindowCreate@@YAXXZ)
1>WindowFunctions.obj : error LNK2019: unresolved external symbol _glfwWindowShouldClose referenced in function "void __cdecl WindowUpdate(void)" (?WindowUpdate@@YAXXZ)
1>WindowFunctions.obj : error LNK2019: unresolved external symbol _glfwPollEvents referenced in function "void __cdecl WindowUpdate(void)" (?WindowUpdate@@YAXXZ)
1>WindowFunctions.obj : error LNK2019: unresolved external symbol _glfwMakeContextCurrent referenced in function "void __cdecl WindowCreate(void)" (?WindowCreate@@YAXXZ)
1>WindowFunctions.obj : error LNK2019: unresolved external symbol _glfwSwapBuffers referenced in function "void __cdecl WindowUpdate(void)" (?WindowUpdate@@YAXXZ)
1>c:\users\finn\documents\visual studio 2013\Projects\[F]Mod\Debug\[F]Mod.exe : fatal error LNK1120: 6 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
现在它说未解析的外部在我的 WindowFunctions.obj 中我不太清楚上发生了什么: - (我是新手glfw和我从来没有真正使用过那么多。
BTW:我的代码是:
Main.cpp的
#include "glfw3.h"
#include "WindowFunctions.h"
int main() {
WindowCreate();
WindowUpdate();
WindowEnd();
return 0;
}
WindowFunctions.cpp
#include "WindowFunctions.h"
#include "glfw3.h"
#include <iostream>
GLFWwindow* Window;
// Setup Voids
void WindowCreate() {
// Setup Window
Window = glfwCreateWindow(640, 480, "[F]Mod", NULL, NULL);
// If GLFW Fails
if (!Window) {
glfwTerminate();
std::cout << "Error 01: GLFW Failed To Start Window" << std::endl;
}
glfwMakeContextCurrent(Window);
}
void WindowUpdate() {
while (!glfwWindowShouldClose(Window))
{
// Constant Operations
glfwSwapBuffers(Window);
glfwPollEvents();
}
}
void WindowEnd() {
glfwTerminate();
}
WindowFunctions.h
//Window Functions
void WindowCreate();
void WindowUpdate();
void WindowEnd();