Metric.cpp needs stdio.h header
Brought to you by:
yeehector
When trying to build perceptualdiff 1.1.1 with cmake 3.22.3 and gcc 5.4.0 on Ubuntu 16.04, the build step fails with the following error:
[ 83%] Building CXX object CMakeFiles/perceptualdiff.dir/Metric.o
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/shims/linux/super/g++-5 -O3 -DNDEBUG -MD -MT CMakeFiles/perceptualdiff.dir/Metric.o -MF CMakeFiles/perceptualdiff.dir/Metric.o.d -o CMakeFiles/perceptualdiff.dir/Metric.o -c /tmp/perceptualdiff-20220319-13352-87e9ko/Metric.cpp
/tmp/perceptualdiff-20220319-13352-87e9ko/Metric.cpp: In function ‘bool Yee_Compare(CompareArgs&)’:
/tmp/perceptualdiff-20220319-13352-87e9ko/Metric.cpp:162:52: error: ‘printf’ was not declared in this scope
if (args.Verbose) printf("Converting RGB to XYZ\n");
^
/tmp/perceptualdiff-20220319-13352-87e9ko/Metric.cpp:186:62: error: ‘printf’ was not declared in this scope
if (args.Verbose) printf("Constructing Laplacian Pyramids\n");
^
/tmp/perceptualdiff-20220319-13352-87e9ko/Metric.cpp:194:46: error: ‘printf’ was not declared in this scope
if (args.Verbose) printf("Performing test\n");
^
/tmp/perceptualdiff-20220319-13352-87e9ko/Metric.cpp:294:63: error: ‘sprintf’ was not declared in this scope
sprintf(different, "%d pixels are different\n", pixels_failed);
^
CMakeFiles/perceptualdiff.dir/build.make:134: recipe for target 'CMakeFiles/perceptualdiff.dir/Metric.o' failed
make[2]: *** [CMakeFiles/perceptualdiff.dir/Metric.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '/tmp/perceptualdiff-20220319-13352-87e9ko'
CMakeFiles/Makefile2:85: recipe for target 'CMakeFiles/perceptualdiff.dir/all' failed
make[1]: *** [CMakeFiles/perceptualdiff.dir/all] Error 2
make[1]: Leaving directory '/tmp/perceptualdiff-20220319-13352-87e9ko'
Makefile:158: recipe for target 'all' failed
make: *** [all] Error 2
Adding include #<stdio.h>
in Metric.cpp
resolved the issue.
Never mind, only just noticed this is fixed in https://sourceforge.net/p/pdiff/code/53/ (added after 1.1.1 release).