Compiling problems with C++ interface under Cygwin

Started by ScannerBoy, July 12, 2021, 06:31:49 PM

Previous topic - Next topic

ScannerBoy

I have been looking at this option for some time, but since it is not available under MSVC, I have left it alone.
Recently, I have become interested again and have compiled the samples in a VMBox under the current Mint without any issues.
When I installed Cygwin under Windows and (hopefully) got all of the utilities installed and sorted out, but I get an error regarding the line
Quotept = (char *)memmem(pt, end-pt, "{ready", 6);
Using the recommended replacement from the forum
Quotept = strstr(pt, "{ready", end-pt);

I get a different error
Quotesrc/ExifToolPipe.cpp:116:36: error: too many arguments to function 'char* strstr(const char*, const char*)'
  116 |    pt = strstr(pt, "{ready", end-pt);
Modifying the line to
Quotept = strstr(pt, "{ready" );

got it all compiled,  :-)
I am posting here, to check if my fudging of the line is acceptable, or if it just happens to work
If it is OK, then perhaps it will help someone else, and it will also help me ;-)

The only issue which initially baffled me: how to pass an argument to these examples.
It seems, even though I am running under cygwin, the path to pass to these test images needs to be a regular Windows path

Now, if I can only get my own app compiled under Cygwin :-)

Phil Harvey

As far as I know, strstr() should take only 2 arguments.  strnstr() takes 3, and the 3rd argument just limits how far the search will go, but this isn't as widely available as strstr().  Without the 3rd argument, the entire string would be searched.

- 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 ($).