ExifTool Forum

ExifTool => Developers => Topic started by: Kento on January 28, 2019, 02:10:09 PM

Title: C++ Config File
Post by: Kento 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:

ExifTool *et = new ExifTool();
et->Command("-config\n~/Downloads/exiftool.config\n-CustomTag=customTag\n~/Downloads/dummy.pdf");
et->Complete();
Title: Re: C++ Config File
Post by: StarGeek 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 (https://exiftool.org/exiftool_pod.html#stay_open-FLAG), as mentioned under "Interface Features" on the C++ interface page.  The -Config option (https://exiftool.org/exiftool_pod.html#config-CFGFILE) cannot appear within the file used by the stay_open option.

Looking at the Constructor Method (http://owl.phy.queensu.ca/~phil/cpp_exiftool/#constructor), 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.
Title: Re: C++ Config File
Post by: Kento 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.
Title: Re: C++ Config File
Post by: Phil Harvey 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