C++ Wrapper missing error_codes.h

Started by Vandmoon, January 18, 2017, 08:22:26 AM

Previous topic - Next topic

Vandmoon

Hi, Phil,

I am trying to use the simple C++ wrapper written by Mark Borg, which was downloaded from the ExifTool website.

But I cannot find a header file named "error_codes.h", which is included by "ExifToolWrapper.cpp".

Anywhere to find the missing file? Thanks!

- Liu


Phil Harvey

Hi Liu,

Try removing that include statement from the code and see what variables are not defined.  Then try to find them in the header files included in your version of Visual C.  It is likely just that they are in a different include file now.  Post back here if you find a solution.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Vandmoon

Hi Phil,

Thank you for your suggestion!

I tried to remove "error_codes.h", and the following variables are missing according to Visual Studio 2015:
CREATE_PIPE_ERROR
hReadErrPipe // read handle
hWriteErrPipe // write handle, used as stdout by child
DUPLICATE_HANDLE_ERROR
CREATE_PROCESS_ERROR

Btw, it seems that <afxwin.h> should be included, otherwise the definition "UINT AFX_CDECL ReadThread(LPVOID pData)" will cause problems.

Any clue?

- Liu

Phil Harvey

Hi Liu,

Good.  Now consult the Visual C documentation or search the include files to find these definitions, then include the appropriate headers.  Let us know how it goes.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Vandmoon

Hi Phil,

Problem solved.

I searched the documentation but no appropriate header found, so I just defined the unrecognized variables by myself, as follows:
#define CREATE_PIPE_ERROR -8
#define DUPLICATE_HANDLE_ERROR -9
#define CREATE_PROCESS_ERROR -10

Since these variables are used to identify the error types, I think it will be OK if the programmer knows what exactly these error codes mean. It is a tricky solution, and I haven't tested it thoroughly. Anyway, it works fine in my program so far.

During my compiling, some sort of errors come out that the handles hWritePipe2 and hReadPipe2 have not been initialized before use. I think there are some confusions between hReadPipe2 and hReadErrPipe, as well as hWritePipe2 and hWriteErrPipe in the function "string my_popen( string cmd )". According to my understanding, these variables are both used for input/output error information. Therefore I unified them and the compiling succeeded.

The adapted code of "ExifToolWrapper.cpp" is attached below. Hope it will help.

- Liu

Phil Harvey

Hi Liu,

Thanks.  I have updated the ExifToolWrapper.zip distribution on the ExifTool home page.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).