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
Error1 error LNK1107: invalid or corrupt file: cannot read at 0x2B0
提问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 :
我遵循的步骤是:
- Copy the Folder Glew and Glut from My folder to your desktop.
- Open Visual Studio , Select New Project
- Select Visual C++, Select Empty Project
- Write OpenGLProject as the name of your project.
- Right click on your project in solution explorer and select add -> add new item.
- Select C++ .cpp item , Name it HelloOpenGL.
- Right Click on your Project again, select properties
- Select all configuration in configuration dropdown list
- Go to C/ C++ -> General
- Go to Additional Include Directories
- Click on the button on right side and select Edit then select glew/include folder
- Click on the button on right side and select Edit then select glut/include folder
- Press OK
- Now Go to Linker - > Input
- Go to Additional Dependencies
- Click on Edit and Right glew32.lib and freeglut.lib.
- Press OK
- Now go to General
- Go to Additional libraries Directories
- Go to the Glew folder and select lib
- Go to the freeglut folder and select lib..
- 将文件夹 Glew 和 Glut 从我的文件夹复制到您的桌面。
- 打开 Visual Studio ,选择新建项目
- 选择Visual C++,选择空项目
- 将 OpenGLProject 写入您的项目名称。
- 在解决方案资源管理器中右键单击您的项目,然后选择添加 -> 添加新项目。
- 选择 C++ .cpp item ,将其命名为 HelloOpenGL。
- 再次右键单击您的项目,选择属性
- 在配置下拉列表中选择所有配置
- 转到 C/C++ -> 常规
- 转到其他包含目录
- 单击右侧的按钮并选择“编辑”,然后选择“glew/include”文件夹
- 单击右侧的按钮并选择编辑,然后选择 glut/include 文件夹
- 按确定
- 现在转到链接器 - >输入
- 转到其他依赖项
- 单击编辑和右键 glew32.lib 和 freeglut.lib。
- 按确定
- 现在去将军
- 转到其他库目录
- 转到 Glew 文件夹并选择 lib
- 转到 freeglut 文件夹并选择 lib..
ThankYou.
谢谢你。
回答by BDL
The error message suggests, that you have linked against glew32.dll
instead 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 复制到可以在运行时找到的地方。