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

user1859793 picture user1859793 · May 4, 2013 · Viewed 21.8k times · Source

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.

Answer

nullptr picture nullptr · May 4, 2013

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.