Author Topic: C++ Config File  (Read 304 times)

Kento

  • Newbie
  • *
  • Posts: 7
C++ Config File
« on: January 28, 2019, 02:10:09 PM »
Hi,

I have been trying to use the C++ interface to manipulate metadata. I created a simple config file that I am using to define some user defined properties.
I can use the config file from the terminal successfully, however when I am trying to do the same thing using C++ it gives me the following error:

Ignored -copnfig option (not first on command line)

The config option is the first option passed in so I am confused why I am getting this error

Here is the code that I have been working with:
Code: [Select]
ExifTool *et = new ExifTool();
et->Command("-config\n~/Downloads/exiftool.config\n-CustomTag=customTag\n~/Downloads/dummy.pdf");
et->Complete();

StarGeek

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 2368
Re: C++ Config File
« Reply #1 on: January 28, 2019, 02:56:16 PM »
You may have to wait a few weeks for an accurate response to this as Phil has gone on vacation and I don't have any C++ experience.

But I think the problem has to do with the fact that the C++ interface uses the -stay_open option, as mentioned under "Interface Features" on the C++ interface page.  The -Config option cannot appear within the file used by the stay_open option.

Looking at the Constructor Method, though, seems to me to indicate the placement for the config option.  The second argument for that is "Optional first argument for application".  So, set the first argument to NULL so the default for exiftool is used and then set the second argument to -config ~/Downloads/exiftool.config.  Since this isn't part of the stay_open, I don't think it should be separated by the new line.
Troubleshooting hints:
* When posting, include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).
* Double all percent signs (%) in a Windows batch file.
* If your GPS coords are negative, make sure and set the GpsLatitudeRef and GpsLongitudeRef tags correctly.

Kento

  • Newbie
  • *
  • Posts: 7
Re: C++ Config File
« Reply #2 on: January 28, 2019, 03:13:34 PM »
Thank you for your answer.
I tried what you suggested by passing the config in the constructor but unfortunately I got the following error:

Invalid TAG name: "config ~/Downloads/exiftool.config"

I have also tried to rename the config file to .ExifTool_config and placing it in the directory where the exiftool exists but this also did not work. It only works when I pass it through the command line.

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14425
    • ExifTool Home Page
Re: C++ Config File
« Reply #3 on: February 08, 2019, 01:01:38 PM »
You can't use the -config option with the C++ interface.  But it should work by naming it .ExifTool_config and putting it in the exiftool directory or your home directory.  I don't know why this doesn't seem to work for  you.

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