I need to include my Exiv2 extension in my project using Makefile. I succeeded to run it directly through terminal with:
g++ -std=c++11 test.cpp -I/usr/local/include -L/usr/local/lib -lexiv2
My original Makefile (it works) important part:
COMPILER_FLAGS = -Wall -c -O2 -std=c++11 -fpic -o
LINKER_FLAGS = -shared
LINKER_DEPENDENCIES = -lphpcpp -lopencv_core -lopencv_imgproc -lopencv_highgui \
-lopencv_ml -lopencv_video -lopencv_features2d \
-lopencv_calib3d -lopencv_objdetect \
Now I have to run a program that uses Exiv2 with a Makefile. Now I'm trying to customize the Makefile, tried
COMPILER_FLAGS = -Wall -c -O2 -std=c++11 -I/usr/local/include -L/usr/local/lib -fpic -o
LINKER_FLAGS = -shared
LINKER_DEPENDENCIES = -lphpcpp -lopencv_core -lopencv_imgproc -lopencv_highgui \
-lopencv_ml -lopencv_video -lopencv_features2d \
-lopencv_calib3d -lopencv_objdetect \
-lexiv2 \
Doesn't work, output of make is:
[root@localhost psdk4]# make
g++ -Wall -c -O2 -std=c++11 -I/usr/local/include -L/usr/local/lib -fpic -o metacopy.o metacopy.cpp
metacopy.cpp: In member function ‘int Params::copyMetadata(int, char**)’:
metacopy.cpp:50:9: error: ‘AutoPtr’ is not a member of ‘Exiv2::BasicIo’
Exiv2::BasicIo::AutoPtr fileIo(new Exiv2::FileIo(params.read_));
^
metacopy.cpp:50:33: error: expected ‘;’ before ‘fileIo’
Exiv2::BasicIo::AutoPtr fileIo(new Exiv2::FileIo(params.read_));
...
It means that it doesn't find the Exiv2 methods, how to customize my Makefile?
AutoPtr(which was an alias tostd::auto_ptr) was removed from Exiv2 in December 2018. Note thatstd::auto_ptritself was deprecated from C++ in 2011 and removed altogether in 2017.Relevant Diff on Github
Your code that depends on
AutoPtris too old. You might be able to update it by replacingAutoPtrwithUniquePtr. You will have to find all places where the formerauto_ptrwas copied (assigned, passed to a function and the like) and insert a call tostd::movearound the source of the copy. The compiler will complain about a deleted function (copy constructor or copy assignment), so it's easy to fix these places one by one. For example:needs to become