3

When I thought that I was finally going to use assimp, I get an error telling me that the .obj file is invalid or corrupt. I looked on the internet and didn't find anything specific for that.

I get the error when I add the .obj file in the Resource Files of my project ( I am using Visual Studio 2013 Express ). The file is located in the same directory as the code of my project.

Here is the beginning of the .obj file, to see if maybe there is an error (I don't think so, because I am following a tutorial which already used this model).

# Blender v2.64 (sub 0) OBJ File: 'nanosuit.blend'
# www.blender.org
mtllib nanosuit.mtl
o Visor
v 0.320384 14.057541 0.507779
v 0.385196 13.984534 0.445066
v 0.416643 14.114325 0.462461
v 0.629804 14.365792 0.220990
v 0.643727 14.511806 0.201993
v 0.624523 14.536142 0.250058
v 0.626923 14.357680 0.224195
v 0.598598 14.519918 0.300183
v 0.605319 14.333345 0.262418
v 0.516982 14.252226 0.379605
v 0.571713 14.503694 0.351682
v 0.522263 14.487471 0.422635
v 0.445928 14.479359 0.506406

All the other files that come together with the .obj file are in the same folder as well.

The error message is this one:

error LNK1136: invalid or corrupt file  C:\Users\Leonardo\documents\visual studio 2013\Projects\OpenGLEngine\OpenGLEngine\nanosuit.obj  1   1   OpenGLEngine

I don't think this problem has anything to do with my code (which was working fine), so I am not posting it here.

lhahn
  • 1,241
  • 2
  • 14
  • 40
  • Well, if you did not change anything, suspect hardware failure. Backup as much as you can NOW. – Martin James Oct 08 '14 at 23:57
  • 3
    This is not the OBJ file you are looking for. It's not a file produced by a compiler and intended as an input to a linker - it's a text file produced by some tool called `Blender`, which just happens to have `.obj` extension. Do not attempt to link it. – Igor Tandetnik Oct 09 '14 at 00:00
  • Strange, because I downloaded another .obj (theoretically) file that does the same problem. – lhahn Oct 09 '14 at 00:01
  • I don't think there is anything wrong with the hardware, or I could be wrong – lhahn Oct 09 '14 at 00:02
  • Wat @Igor Tandetnik means is that your project file setup is trying to link a 3d-file *.obj as a compiled code *.obj – PeterT Oct 09 '14 at 00:02
  • @IgorTandetnik what would be a correct .obj file?, from what I've seen this file looks like a normal .obj file (syntax wise) – lhahn Oct 09 '14 at 00:12
  • What do you mean, "syntax-wise"? `.obj` files, as produced by a C++ compiler and fed to a linker, are binary files. They look like random garbage in a text viewer. – Igor Tandetnik Oct 09 '14 at 00:14
  • 1
    @lhahn it is but you have a [3D file](http://en.wikipedia.org/wiki/Wavefront_.obj_file) and Visual Studio thinks it's a [object code](http://en.wikipedia.org/wiki/Object_file) file when you add it to the project – PeterT Oct 09 '14 at 00:14
  • @lhahn either put the *.obj model in some subfolder and remove it from the project filters or rename it to something like `nanosuit.mobj`.That will make sure that Visual Studio doesn't confuse it – PeterT Oct 09 '14 at 00:30
  • I works, now I have to see if assimp recognize .mobj files – lhahn Oct 09 '14 at 00:37
  • 1
    Thanks for the help, I just took the .obj file out of my project folders, and now it works fine. – lhahn Oct 09 '14 at 00:43
  • Same problem here with VS2019. Renaming to `nanosuit.mobj` didn't do anything, but simply right-clicking in Solution Explorer and then _Exclude from Project_ made it work. – Agent49 Jan 05 '20 at 16:37

0 Answers0