Hello to all, i encounter an error like Error 1 fatal error LNK1107: invalid
or corrupt file: cannot read at 0x2C8 C:\Program Files\OpenCV\bin\highgui110.dll

Additional Include Directories
C:\Program Files\OpenCV\cxcore\include
C:\Program Files\OpenCV\otherlibs\highgui
C:\Program Files\OpenCV\cv\include

Additional Library Directories
C:\Program Files\OpenCV\otherlibs
C:\Program Files\OpenCV\lib
C:\Program Files\OpenCV\bin


Additional Dependencies
cv.lib
highgui.lib
cxcore.lib
highgui110.dll

Error Message is

Error 1 fatal error LNK1107: invalid or corrupt file: cannot read at 0x2C8 C:\Program Files\OpenCV\bin\highgui110.dll 1 OpenCV Capture

What wrong with highgui.dll ?

Please help.

Thanks.

This is my source code.


Code:

#ifndef CAM_CAPTURE_H
#define CAM_CAPTURE_H


#include "cv.h"
#include "highgui.h"

class CamCapture
{
private:
CvCapture* myCaptureHandler;
IplImage* videoFrame;
int key;

public:
CamCapture();
~CamCapture();

void Init();

};


#endif

Nick Evan commented: >30 posts and no code-tags -6

You should change:

#include "cv.h"
#include "highgui.h"

to:

#include <cv.h>
#include <highgui.h">

also check manually if the file C:\Program Files\OpenCV\bin\highgui110.dll exists. If it does: re-install openCV

Next time you post: use code-tags. Also bumping your thread is considered very rude and you're lucky I'm in a good mood today else you would've gotton no reply at all.

Sorry about that. I will not do that in future.


AFAIK, the <> is means that the dll is not same directory with my project folder.

Why i need to change that since i have compiler settings that reference the library directory ?

I have solve the problem by link .lib and putting dll in the directory same with exe.

Why i need to link with .lib instead of the dll ?

Thanks.

AFAIK, the <> is means that the dll is not same directory with my project folder.

Yes, and that is why you needed the <>. The files weren't in the same dir as your sourcefiles.

> AFAIK, the <> is means that the dll is not same directory with my project folder.
<> vs. "" has nothing to do with your DLL.

#include is processed by the compiler, to read a .h file which is another text file.

The error messages you're getting are LINKER error messages.
http://www.fismat.umich.mx/mn1/teaching_C/node4.html

> invalid or corrupt file: cannot read at 0x2C8 C:\Program Files\OpenCV\bin\highgui110.dll
In essence, the linker hasn't got a clue what this DLL is.
Since your other 3 files are .lib, perhaps you should try highgui110.lib.

You can't just grab any .dll meant for any other compiler, and expect it to work with your compiler (which are you using by the way?)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.