C++ Error1 错误 LNK1107:无效或损坏的文件:无法在 0x2B0 读取

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35916703/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 14:34:08  来源:igfitidea点击:

Error1 error LNK1107: invalid or corrupt file: cannot read at 0x2B0

c++openglvisual-studio-2012

提问by Uzair

I am new in opengl and i have no idea what this error means. I am using Visual Studio 2012 > C++ > Empty Project. I Follow these steps in other pc thats work for me but i am doing this in my pc i am getting this error.

我是 opengl 的新手,我不知道这个错误是什么意思。我正在使用 Visual Studio 2012 > C++ > 空项目。我在对我有用的其他电脑上按照这些步骤操作,但我在我的电脑上执行此操作时出现此错误。

ERROR

Error 1 error LNK1107: invalid or corrupt file: cannot read at 0x2B0 ?>C:\Users\Uxi\Desktop\Sp16 \Vs\OpenglPrac\OpenglPrac\glew32.dll 1 1 >OpenglPrac

错误

错误 1 ​​错误 LNK1107:无效或损坏的文件:无法在 0x2B0 处读取?>C:\Users\Uxi\Desktop\Sp16\Vs\OpenglPrac\OpenglPrac\glew32.dll 1 1 >OpenglPrac

Steps i Follow Is :

我遵循的步骤是:

  1. Copy the Folder Glew and Glut from My folder to your desktop.
  2. Open Visual Studio , Select New Project
  3. Select Visual C++, Select Empty Project
  4. Write OpenGLProject as the name of your project.
  5. Right click on your project in solution explorer and select add -> add new item.
  6. Select C++ .cpp item , Name it HelloOpenGL.
  7. Right Click on your Project again, select properties
  8. Select all configuration in configuration dropdown list
  9. Go to C/ C++ -> General
  10. Go to Additional Include Directories
  11. Click on the button on right side and select Edit then select glew/include folder
  12. Click on the button on right side and select Edit then select glut/include folder
  13. Press OK
  14. Now Go to Linker - > Input
  15. Go to Additional Dependencies
  16. Click on Edit and Right glew32.lib and freeglut.lib.
  17. Press OK
  18. Now go to General
  19. Go to Additional libraries Directories
  20. Go to the Glew folder and select lib
  21. Go to the freeglut folder and select lib..
  1. 将文件夹 Glew 和 Glut 从我的文件夹复制到您的桌面。
  2. 打开 Visual Studio ,选择新建项目
  3. 选择Visual C++,选择空项目
  4. 将 OpenGLProject 写入您的项目名称。
  5. 在解决方案资源管理器中右键单击您的项目,然后选择添加 -> 添加新项目。
  6. 选择 C++ .cpp item ,将其命名为 HelloOpenGL。
  7. 再次右键单击您的项目,选择属性
  8. 在配置下拉列表中选择所有配置
  9. 转到 C/C++ -> 常规
  10. 转到其他包含目录
  11. 单击右侧的按钮并选择“编辑”,然后选择“glew/include”文件夹
  12. 单击右侧的按钮并选择编辑,然后选择 glut/include 文件夹
  13. 按确定
  14. 现在转到链接器 - >输入
  15. 转到其他依赖项
  16. 单击编辑和右键 glew32.lib 和 freeglut.lib。
  17. 按确定
  18. 现在去将军
  19. 转到其他库目录
  20. 转到 Glew 文件夹并选择 lib
  21. 转到 freeglut 文件夹并选择 lib..

ThankYou.

谢谢你。

回答by BDL

The error message suggests, that you have linked against glew32.dllinstead of glew32.lib. One always has to link against the lib file and copy the dll to a place where it can be found at runtime.

错误消息表明,您已链接到glew32.dll而不是glew32.lib。人们总是必须链接到 lib 文件并将 dll 复制到可以在运行时找到的地方。