Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.obj : fatal error LNK1107: invalid or corrupt file: cannot read at 0x6592

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.

like image 599
user1859793 Avatar asked May 04 '13 10:05

user1859793


2 Answers

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.

like image 147
nullptr Avatar answered Sep 29 '22 15:09

nullptr


I had the same problem and resolved it by excluding the .obj file from the build. In other words:

  1. Right click your .obj file.
  2. Click 'Properties
  3. Set 'Exclude from Build' to 'Yes'
like image 22
M B Avatar answered Sep 29 '22 14:09

M B