-1

我在 glfw 中有一个项目,我正在代码块中创建,因为我一直想尝试 Visual Studio 我决定转移它,代码在代码块中运行时编译得很好。但是在 Visual Studio 中,我收到以下错误:

Error   1   error LNK2019: unresolved external symbol __imp__glClear@4 referenced in function "void __cdecl Main_Loop(void)" (?Main_Loop@@YAXXZ)    c:\Users\Samuel\documents\visual studio 2012\Projects\Project1\Project1\main.obj    Project1
Error   2   error LNK2019: unresolved external symbol __imp__glClearColor@16 referenced in function "void __cdecl Init(void)" (?Init@@YAXXZ)    c:\Users\Samuel\documents\visual studio 2012\Projects\Project1\Project1\main.obj    Project1
Error   3   error LNK2019: unresolved external symbol __imp__glFrustum@48 referenced in function "void __cdecl Init(void)" (?Init@@YAXXZ)   c:\Users\Samuel\documents\visual studio 2012\Projects\Project1\Project1\main.obj    Project1
Error   4   error LNK2019: unresolved external symbol __imp__glLoadIdentity@0 referenced in function "void __cdecl Draw(class TextRenderer,class Button)" (?Draw@@YAXVTextRenderer@@VButton@@@Z)    c:\Users\Samuel\documents\visual studio 2012\Projects\Project1\Project1\main.obj    Project1
Error   5   error LNK2001: unresolved external symbol __imp__glLoadIdentity@0   c:\Users\Samuel\documents\visual studio 2012\Projects\Project1\Project1\TextRenderer.obj    Project1
Error   6   error LNK2019: unresolved external symbol __imp__glMatrixMode@4 referenced in function "void __cdecl Init(void)" (?Init@@YAXXZ) c:\Users\Samuel\documents\visual studio 2012\Projects\Project1\Project1\main.obj    Project1
Error   7   error LNK2019: unresolved external symbol __imp__glTranslatef@12 referenced in function "void __cdecl Draw(class TextRenderer,class Button)" (?Draw@@YAXVTextRenderer@@VButton@@@Z) c:\Users\Samuel\documents\visual studio 2012\Projects\Project1\Project1\main.obj    Project1
Error   8   error LNK2019: unresolved external symbol __imp__glewInit@0 referenced in function "void __cdecl glInit(void)" (?glInit@@YAXXZ) c:\Users\Samuel\documents\visual studio 2012\Projects\Project1\Project1\main.obj    Project1
Error   9   error LNK2019: unresolved external symbol __imp__glewIsSupported@4 referenced in function "void __cdecl glInit(void)" (?glInit@@YAXXZ)  c:\Users\Samuel\documents\visual studio 2012\Projects\Project1\Project1\main.obj    Project1
Error   10  error LNK2019: unresolved external symbol _glfwInit referenced in function "void __cdecl Init(void)" (?Init@@YAXXZ) c:\Users\Samuel\documents\visual studio 2012\Projects\Project1\Project1\main.obj    Project1
Error   11  error LNK2019: unresolved external symbol _glfwTerminate referenced in function "void __cdecl Shut_Down(int)" (?Shut_Down@@YAXH@Z)  c:\Users\Samuel\documents\visual studio 2012\Projects\Project1\Project1\main.obj    Project1
Error   12  error LNK2019: unresolved external symbol _glfwOpenWindow referenced in function "void __cdecl Init(void)" (?Init@@YAXXZ)   c:\Users\Samuel\documents\visual studio 2012\Projects\Project1\Project1\main.obj    Project1
Error   13  error LNK2019: unresolved external symbol _glfwSetWindowTitle referenced in function "void __cdecl Init(void)" (?Init@@YAXXZ)   c:\Users\Samuel\documents\visual studio 2012\Projects\Project1\Project1\main.obj    Project1
Error   14  error LNK2019: unresolved external symbol _glfwSwapBuffers referenced in function "void __cdecl Main_Loop(void)" (?Main_Loop@@YAXXZ)    c:\Users\Samuel\documents\visual studio 2012\Projects\Project1\Project1\main.obj    Project1
Error   15  error LNK2019: unresolved external symbol _glfwGetWindowParam referenced in function "void __cdecl Main_Loop(void)" (?Main_Loop@@YAXXZ) c:\Users\Samuel\documents\visual studio 2012\Projects\Project1\Project1\main.obj    Project1
Error   16  error LNK2019: unresolved external symbol __imp__FT_Init_FreeType referenced in function "void __cdecl fontInit(void)" (?fontInit@@YAXXZ)   c:\Users\Samuel\documents\visual studio 2012\Projects\Project1\Project1\main.obj    Project1
Error   17  error LNK2019: unresolved external symbol __imp__FT_New_Face referenced in function "void __cdecl fontInit(void)" (?fontInit@@YAXXZ)    c:\Users\Samuel\documents\visual studio 2012\Projects\Project1\Project1\main.obj    Project1
Error   18  error LNK2019: unresolved external symbol __imp__glBegin@4 referenced in function "public: virtual void __thiscall Button::render(void)" (?render@Button@@UAEXXZ)   c:\Users\Samuel\documents\visual studio 2012\Projects\Project1\Project1\Button.obj  Project1
Error   19  error LNK2001: unresolved external symbol __imp__glBegin@4  c:\Users\Samuel\documents\visual studio 2012\Projects\Project1\Project1\TextRenderer.obj    Project1
Error   20  error LNK2019: unresolved external symbol __imp__glEnd@0 referenced in function "public: virtual void __thiscall Button::render(void)" (?render@Button@@UAEXXZ) c:\Users\Samuel\documents\visual studio 2012\Projects\Project1\Project1\Button.obj  Project1
Error   21  error LNK2001: unresolved external symbol __imp__glEnd@0    c:\Users\Samuel\documents\visual studio 2012\Projects\Project1\Project1\TextRenderer.obj    Project1
Error   22  error LNK2019: unresolved external symbol __imp__glVertex2f@8 referenced in function "public: virtual void __thiscall Button::render(void)" (?render@Button@@UAEXXZ)    c:\Users\Samuel\documents\visual studio 2012\Projects\Project1\Project1\Button.obj  Project1
Error   23  error LNK2001: unresolved external symbol __imp__glVertex2f@8   c:\Users\Samuel\documents\visual studio 2012\Projects\Project1\Project1\TextRenderer.obj    Project1
Error   24  error LNK2019: unresolved external symbol __imp__glColor3f@12 referenced in function "public: virtual void __thiscall Button::render(void)" (?render@Button@@UAEXXZ)    c:\Users\Samuel\documents\visual studio 2012\Projects\Project1\Project1\Button.obj  Project1
Error   25  error LNK2001: unresolved external symbol __imp__glColor3f@12   c:\Users\Samuel\documents\visual studio 2012\Projects\Project1\Project1\TextRenderer.obj    Project1
Error   26  error LNK2019: unresolved external symbol __imp__glBindTexture@8 referenced in function "public: void __thiscall TextRenderer::draw(struct FT_Bitmap_ *,float,float)" (?draw@TextRenderer@@QAEXPAUFT_Bitmap_@@MM@Z) c:\Users\Samuel\documents\visual studio 2012\Projects\Project1\Project1\TextRenderer.obj    Project1
Error   27  error LNK2019: unresolved external symbol __imp__glBlendFunc@8 referenced in function "public: void __thiscall TextRenderer::draw(struct FT_Bitmap_ *,float,float)" (?draw@TextRenderer@@QAEXPAUFT_Bitmap_@@MM@Z)   c:\Users\Samuel\documents\visual studio 2012\Projects\Project1\Project1\TextRenderer.obj    Project1
Error   28  error LNK2019: unresolved external symbol __imp__glDeleteTextures@8 referenced in function "public: void __thiscall TextRenderer::draw(struct FT_Bitmap_ *,float,float)" (?draw@TextRenderer@@QAEXPAUFT_Bitmap_@@MM@Z)  c:\Users\Samuel\documents\visual studio 2012\Projects\Project1\Project1\TextRenderer.obj    Project1
Error   29  error LNK2019: unresolved external symbol __imp__glDisable@4 referenced in function "public: void __thiscall TextRenderer::draw(struct FT_Bitmap_ *,float,float)" (?draw@TextRenderer@@QAEXPAUFT_Bitmap_@@MM@Z) c:\Users\Samuel\documents\visual studio 2012\Projects\Project1\Project1\TextRenderer.obj    Project1
Error   30  error LNK2019: unresolved external symbol __imp__glEnable@4 referenced in function "public: void __thiscall TextRenderer::draw(struct FT_Bitmap_ *,float,float)" (?draw@TextRenderer@@QAEXPAUFT_Bitmap_@@MM@Z)  c:\Users\Samuel\documents\visual studio 2012\Projects\Project1\Project1\TextRenderer.obj    Project1
Error   31  error LNK2019: unresolved external symbol __imp__glGenTextures@8 referenced in function "public: void __thiscall TextRenderer::draw(struct FT_Bitmap_ *,float,float)" (?draw@TextRenderer@@QAEXPAUFT_Bitmap_@@MM@Z) c:\Users\Samuel\documents\visual studio 2012\Projects\Project1\Project1\TextRenderer.obj    Project1
Error   32  error LNK2019: unresolved external symbol __imp__glPixelStorei@8 referenced in function "public: void __thiscall TextRenderer::draw(struct FT_Bitmap_ *,float,float)" (?draw@TextRenderer@@QAEXPAUFT_Bitmap_@@MM@Z) c:\Users\Samuel\documents\visual studio 2012\Projects\Project1\Project1\TextRenderer.obj    Project1
Error   33  error LNK2019: unresolved external symbol __imp__glScalef@12 referenced in function "public: void __thiscall TextRenderer::draw(struct FT_Bitmap_ *,float,float)" (?draw@TextRenderer@@QAEXPAUFT_Bitmap_@@MM@Z) c:\Users\Samuel\documents\visual studio 2012\Projects\Project1\Project1\TextRenderer.obj    Project1
Error   34  error LNK2019: unresolved external symbol __imp__glTexCoord2f@8 referenced in function "public: void __thiscall TextRenderer::draw(struct FT_Bitmap_ *,float,float)" (?draw@TextRenderer@@QAEXPAUFT_Bitmap_@@MM@Z)  c:\Users\Samuel\documents\visual studio 2012\Projects\Project1\Project1\TextRenderer.obj    Project1
Error   35  error LNK2019: unresolved external symbol __imp__glTexImage2D@36 referenced in function "public: void __thiscall TextRenderer::draw(struct FT_Bitmap_ *,float,float)" (?draw@TextRenderer@@QAEXPAUFT_Bitmap_@@MM@Z) c:\Users\Samuel\documents\visual studio 2012\Projects\Project1\Project1\TextRenderer.obj    Project1
Error   36  error LNK2019: unresolved external symbol __imp__glTexParameteri@12 referenced in function "public: void __thiscall TextRenderer::draw(struct FT_Bitmap_ *,float,float)" (?draw@TextRenderer@@QAEXPAUFT_Bitmap_@@MM@Z)  c:\Users\Samuel\documents\visual studio 2012\Projects\Project1\Project1\TextRenderer.obj    Project1
Error   37  error LNK2019: unresolved external symbol __imp__FT_Set_Char_Size referenced in function "public: __thiscall TextRenderer::TextRenderer(float,float,struct FT_FaceRec_ * *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,float)" (??0TextRenderer@@QAE@MMPAPAUFT_FaceRec_@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@M@Z) c:\Users\Samuel\documents\visual studio 2012\Projects\Project1\Project1\TextRenderer.obj    Project1
Error   38  error LNK2019: unresolved external symbol __imp__FT_Load_Glyph referenced in function "public: virtual void __thiscall TextRenderer::render(void)" (?render@TextRenderer@@UAEXXZ)   c:\Users\Samuel\documents\visual studio 2012\Projects\Project1\Project1\TextRenderer.obj    Project1
Error   39  error LNK2019: unresolved external symbol __imp__FT_Get_Char_Index referenced in function "public: virtual void __thiscall TextRenderer::render(void)" (?render@TextRenderer@@UAEXXZ)   c:\Users\Samuel\documents\visual studio 2012\Projects\Project1\Project1\TextRenderer.obj    Project1
Error   40  error LNK1120: 34 unresolved externals  c:\users\samuel\documents\visual studio 2012\Projects\Project1\Debug\Project1.exe   Project1

这个错误是由什么引起的?

编辑:根据您的回复,我似乎错误地链接了库,现在我没有收到上述错误,但我得到了一个新错误: 错误 更多信息:

这是视觉工作室给我的输出

“Project1.exe”(Win32):加载“C:\Users\Samuel\Documents\Visual Studio 2012\Projects\Project1\Debug\Project1.exe”。已加载符号。“Project1.exe”(Win32):已加载“C:\Windows\SysWOW64\ntdll.dll”。无法找到或打开 PDB 文件。“Project1.exe”(Win32):已加载“C:\Program Files\AVAST Software\Avast\snxhk.dll”。无法找到或打开 PDB 文件。“Project1.exe”(Win32):已加载“C:\Windows\SysWOW64\kernel32.dll”。无法找到或打开 PDB 文件。“Project1.exe”(Win32):已加载“C:\Windows\SysWOW64\KernelBase.dll”。无法找到或打开 PDB 文件。“Project1.exe”(Win32):已加载“C:\Windows\SysWOW64\opengl32.dll”。无法找到或打开 PDB 文件。“Project1.exe”(Win32):已加载“C:\Windows\SysWOW64\user32.dll”。无法找到或打开 PDB 文件。“Project1.exe”(Win32):已加载“C:\Windows\glew32.dll”。模块是在没有符号的情况下构建的。“Project1.exe”(Win32):已加载“C:\Windows\System\freetype6.dll”。模块是在没有符号的情况下构建的。“Project1.exe”(Win32):已加载“C:\Windows\SysWOW64\msvcp110d.dll”。已加载符号。“Project1.exe”(Win32):已加载“C:\Windows\SysWOW64\msvcr110d.dll”。已加载符号。“Project1.exe”(Win32):已加载“C:\Windows\SysWOW64\msvcrt.dll”。无法找到或打开 PDB 文件。“Project1.exe”(Win32):已加载“C:\Windows\SysWOW64\advapi32.dll”。无法找到或打开 PDB 文件。“Project1.exe”(Win32):已加载“C:\Windows\SysWOW64\gdi32.dll”。无法找到或打开 PDB 文件。'Project1.exe' (Win32): 已加载“C:\Windows\SysWOW64\glu32.dll”。无法找到或打开 PDB 文件。“Project1.exe”(Win32):已加载“C:\Windows\SysWOW64\ddraw.dll”。无法找到或打开 PDB 文件。“Project1.exe”(Win32):已加载“C:\Windows\System\zlib1.dll”。模块是在没有符号的情况下构建的。“Project1.exe”(Win32):已加载“C:\Windows\SysWOW64\sechost.dll”。无法找到或打开 PDB 文件。“Project1.exe”(Win32):已加载“C:\Windows\SysWOW64\rpcrt4.dll”。无法找到或打开 PDB 文件。“Project1.exe”(Win32):已加载“C:\Windows\SysWOW64\dciman32.dll”。无法找到或打开 PDB 文件。Project1.exe 中 0x77BEB0AE (ntdll.dll) 的第一次机会异常:0xC0000139:未找到入口点。程序“[9044] Project1.exe”

4

1 回答 1

2

根据对问题的评论,我想我可以提供一个不错的答案。您需要链接一些库(glfw、glew、opengl23)。在 Visual Studio 中,添加库是在Linker项目属性部分完成的。更具体地说:Properties > Linker > Input > Additional Dependencies

可以在 中添加库的其他搜索目录Properties > Linker > General > Additional Library Directories

于 2013-08-20T21:18:31.470 回答