我在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文件。 0x77BEB0AE的第一次机会异常 Project1.exe中的(ntdll.dll):0xC0000139:找不到入口点。该 程序'[9044] Project1.exe'已退出,代码为-1073741511 (0xc0000139)'找不到入口点'。
答案 0 :(得分:2)
根据对问题的评论,我想我可以提供一个体面的答案。你需要链接一些库(glfw,glew,opengl23)。在Visual Studio中,添加库是在项目属性的Linker
部分中完成的。更具体地说:Properties > Linker > Input > Additional Dependencies
。
可以在Properties > Linker > General > Additional Library Directories
添加库的其他搜索目录。