简体   繁体   English

Visual Studio 10中的GLFW链接器错误

[英]GLFW Linker errors in Visual Studio 10

I'm having trouble setting up GLFW on Visual Studio 10.0 I was following this guys tutorial. 我在遵循此人教程的Visual Studio 10.0上设置GLFW时遇到问题。 However I am still getting linking errors 但是我仍然收到链接错误

1>GLFW.lib(window.obj) : error LNK2005: __glfwClearWindowHints already defined in window.obj
1>GLFW.lib(window.obj) : error LNK2005: __glfwClearInput already defined in window.obj
1>GLFW.lib(window.obj) : error LNK2005: __glfwInputKey already defined in window.obj
1>GLFW.lib(window.obj) : error LNK2005: __glfwInputChar already defined in window.obj
1>GLFW.lib(window.obj) : error LNK2005: __glfwInputMouseClick already defined in window.obj
1>GLFW.lib(window.obj) : error LNK2005: __glfwChooseFBConfig already defined in window.obj
1>GLFW.lib(window.obj) : error LNK2005: __glfwInputDeactivation already defined in window.obj
1>GLFW.lib(init.obj) : error LNK2005: __glfwInitialized already defined in init.obj
1>GLFW.lib(glext.obj) : error LNK2005: __glfwParseGLVersion already defined in glext.obj
1>GLFW.lib(glext.obj) : error LNK2005: __glfwStringInExtensionString already defined in glext.obj
1>GLFW.lib(glext.obj) : error LNK2005: __glfwRefreshContextParams already defined in glext.obj
1>MSVCRTD.lib(cinitexe.obj) : warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library

I have tried googling the errors but I havent found much help. 我曾尝试使用Google搜索错误,但没有找到太多帮助。 I have linked opengl32/lib and glu32.lib in the linker settings. 我已经在链接器设置中链接了opengl32 / lib和glu32.lib。 I have also linked the appropriate folders for include and lib. 我还链接了包括和lib的适当文件夹。 I downloaded and linked both the win32 binaries and the original zip from the GLFW site. 我从GLFW网站下载并链接了win32二进制文件和原始zip。

code

Any help is appreciated. 任何帮助表示赞赏。

That tutorial is kinda outdated (posted 27 April 2005). 该教程有点过时了(发布于2005年4月27日)。 You probably added some source files twice to two different projects, thus the complaints about already existing definitions of symbols. 您可能两次向两个不同的项目中添加了一些源文件,因此对符号的已有定义提出了抱怨。

It seems that GLFW 2.7.x does not include MSVC makefile scripts for automatically build everything you need, but if its an option to switch to the latest GLFW 3.0 you could make your life easier because they support cmake: 似乎GLFW 2.7.x不包含用于自动构建所需所有内容的MSVC makefile脚本,但是如果可以选择切换到最新的GLFW 3.0,则可以使您的生活更轻松,因为它们支持cmake:

  • Make sure you have both cmake and git installed. 确保同时安装了cmakegit
  • From your Git Bash run git clone git://glfw.git.sourceforge.net/gitroot/glfw/glfw glfw 从您的Git Bash运行git clone git://glfw.git.sourceforge.net/gitroot/glfw/glfw glfw
  • Then open a Visual Studio command prompt and switch to the newly created glfw folder. 然后打开Visual Studio命令提示符并切换到新创建的glfw文件夹。 Create a new sub-folder ( mkdir build ) and switch into this one ( cd build ). 创建一个新的子文件夹( mkdir build )并切换到该子文件夹( cd build )。
  • Now run cmake -G "Visual Studio 10 Win64" .. which generates the project files for compiling GLFW. 现在运行cmake -G "Visual Studio 10 Win64" ..生成用于编译GLFW的项目文件。
  • Open that project file and compile everything you need (only the GLFW sub-project is required) 打开该项目文件并编译您需要的所有内容(仅需要GLFW子项目)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM