Author Topic: C++ Wrapper missing error_codes.h  (Read 999 times)

Vandmoon

  • Newbie
  • *
  • Posts: 3
C++ Wrapper missing error_codes.h
« on: January 18, 2017, 08:22:26 AM »
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

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 11830
    • ExifTool Home Page
Re: C++ Wrapper missing error_codes.h
« Reply #1 on: January 18, 2017, 08:28:33 AM »
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 containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Vandmoon

  • Newbie
  • *
  • Posts: 3
Re: C++ Wrapper missing error_codes.h
« Reply #2 on: January 18, 2017, 09:07:49 AM »
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

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 11830
    • ExifTool Home Page
Re: C++ Wrapper missing error_codes.h
« Reply #3 on: January 18, 2017, 09:59:45 AM »
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 containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Vandmoon

  • Newbie
  • *
  • Posts: 3
Re: C++ Wrapper missing error_codes.h
« Reply #4 on: January 19, 2017, 09:56:51 PM »
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

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 11830
    • ExifTool Home Page
Re: C++ Wrapper missing error_codes.h
« Reply #5 on: January 20, 2017, 07:22:17 AM »
Hi Liu,

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

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