Weird linker error linking to opencv... "LNK1107: invalid or corrupt file: cannot read at 0x2E8"
18,984
If I would have to guess (partially based on the documentation of that error), I'd say you're trying to link directly against the DLL.
You probably want to link against its corresponding .lib file.
Author by
Jim
Updated on June 12, 2022Comments
-
Jim about 2 years
This OpenCV build was working for me a few nights ago. I am trying to run the example
grabcut.cpp
file given with the OpenCV examples and so I set up a quick project and brough thecpp
file in. Then, I set up all of the standard configurations and got this error on building.error LNK1107: invalid or corrupt file: cannot read at 0x2E8 opencv_calib3d231.dll
What does this mean?
-
Jim over 12 yearsI feel like I always linked against DLLs before... That's not normal?
-
user1071136 over 12 yearsDepends on the compiler; MinGW, for example, seems to be able to directly link against DLLs.
-
Bart over 12 yearsHmm, I don't know about MinGW. Perhaps you're right. It might do something similar as one could do with Visual Studio's tools to generate a .def and thereby a .lib from a DLL. However (unless anyone can tell me otherwise) I don't think Visual Studio allows for direct linking against a DLL. You either have to use a .lib or dynamically load the DLL in your code.
-
Elshan about 8 yearsmake sure you are linking
.lib
file instead.dll
-
Benjamin Crawford Ctrl-Alt-Tut almost 4 yearsAnother common case of this exact error is when accidentally missing the
-o
flag, thus mistakenly specifying a binary as a source file.