问题
I am trying to load an .obj model into my c++ opengl 3 code but for some reason it gives me this error :
1>Linking... 1>.\bunny.obj : fatal error LNK1107: invalid or corrupt file: cannot read at 0x6592
I tried to search for similar errors, but there were about .dll's or .lib's.
Can you please help me out with this issue. I have also tried with different obj models but it always gives me this error.
回答1:
You are trying to load your object model with a C++ linker (probably you have just added it to the project, and now it tries to be compiled). The linker can process .obj files, but it waits them to be 'object-code' files (which also often have .obj extension), which are just compiled modules (e.g. written in C++ language) ready to be linked into a single executable or DLL.
Neither part of a C++ compiler is able to read graphical object model. You should remove the .obj file from your IDE project. And make sure you have a code that reads the file when the program runs.
If you want the object model to be embedded into your .EXE (so the program would not require the file in its directory), then you can put it into resources and link them with the executable.
回答2:
I had the same problem and resolved it by excluding the .obj file from the build. In other words:
- Right click your .obj file.
- Click 'Properties
- Set 'Exclude from Build' to 'Yes'
来源:https://stackoverflow.com/questions/16373522/obj-fatal-error-lnk1107-invalid-or-corrupt-file-cannot-read-at-0x6592