@slacky, I PMed @Brandon but he seems to be away. He might get back to me after the holidays, but if you remember anything else in the meantime it will help.
I think I was able to port MatchTempl forward to OpenCV 3.4.0, but I still receive strange linking errors:
Code:
$ mingw32-make.exe
x86_64-w64-mingw32-g++ -Wall -std=c++11 -DBUILD_DLL -shared -Iopencv/build/install/include -Lopencv/build/install/x64/mingw/staticlib -Lopencv/build/3rdparty/lib -luser32 -lcomctl32 -lvfw32 -lIlmImf -llibjasper -llibjpeg -llibpng -llibprotobuf -llibtiff -llibwebp -lopencv_aruco340 -lopencv_bgsegm340 -lopencv_bioinspired340 -lopencv_calib3d340 -lopencv_ccalib340 -lopencv_core340 -lopencv_datasets340 -lopencv_dnn340 -lopencv_dpm340 -lopencv_face340 -lopencv_features2d340 -lopencv_flann340 -lopencv_fuzzy340 -lopencv_highgui340 -lopencv_img_hash340 -lopencv_imgcodecs340 -lopencv_imgproc340 -lopencv_line_descriptor340 -lopencv_ml340 -lopencv_objdetect340 -lopencv_optflow340 -lopencv_phase_unwrapping340 -lopencv_photo340 -lopencv_plot340 -lopencv_reg340 -lopencv_rgbd340 -lopencv_saliency340 -lopencv_shape340 -lopencv_stereo340 -lopencv_stitching340 -lopencv_structured_light340 -lopencv_superres340 -lopencv_surface_matching340 -lopencv_text340 -lopencv_tracking340 -lopencv_video340 -lopencv_videoio340 -lopencv_videostab340 -lopencv_xfeatures2d340 -lopencv_ximgproc340 -lopencv_xobjdetect340 -lopencv_xphoto340 -lzlib -o libMatchTempl.dll main.cpp MatchTempl.cpp MatchTempl.hpp
C:\Cygwin64\tmp\ccG5K8IR.o:MatchTempl.cpp:(.text+0x5d): undefined reference to `cv::imread(cv::String const&, int)'
C:\Cygwin64\tmp\ccG5K8IR.o:MatchTempl.cpp:(.text+0x294): undefined reference to `cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)'
C:\Cygwin64\tmp\ccG5K8IR.o:MatchTempl.cpp:(.text+0x5f4): undefined reference to `cv::noArray()'
C:\Cygwin64\tmp\ccG5K8IR.o:MatchTempl.cpp:(.text+0x65d): undefined reference to `cv::matchTemplate(cv::_InputArray const&, cv::_InputArray const&, cv::_OutputArray const&, int, cv::_InputArray const&)'
C:\Cygwin64\tmp\ccG5K8IR.o:MatchTempl.cpp:(.text+0x71a): undefined reference to `cv::normalize(cv::_InputArray const&, cv::_InputOutputArray const&, double, double, int, int, cv::_InputArray const&)'
C:\Cygwin64\tmp\ccG5K8IR.o:MatchTempl.cpp:(.text$_ZN2cv6StringC1EPKc[_ZN2cv6StringC1EPKc]+0x51): undefined reference to `cv::String::allocate(unsigned long long)'
C:\Cygwin64\tmp\ccG5K8IR.o:MatchTempl.cpp:(.text$_ZN2cv6StringD1Ev[_ZN2cv6StringD1Ev]+0x11): undefined reference to `cv::String::deallocate()'
C:\Cygwin64\tmp\ccG5K8IR.o:MatchTempl.cpp:(.text$_ZN2cv3MatC1EiiiPvy[_ZN2cv3MatC1EiiiPvy]+0x122): undefined reference to `cv::error(int, cv::String const&, char const*, char const*, int)'
C:\Cygwin64\tmp\ccG5K8IR.o:MatchTempl.cpp:(.text$_ZN2cv3MatC1EiiiPvy[_ZN2cv3MatC1EiiiPvy]+0x207): undefined reference to `cv::error(int, cv::String const&, char const*, char const*, int)'
C:\Cygwin64\tmp\ccG5K8IR.o:MatchTempl.cpp:(.text$_ZN2cv3MatD1Ev[_ZN2cv3MatD1Ev]+0x36): undefined reference to `cv::fastFree(void*)'
C:\Cygwin64\tmp\ccG5K8IR.o:MatchTempl.cpp:(.text$_ZNK2cv3Mat5cloneEv[_ZNK2cv3Mat5cloneEv]+0x3b): undefined reference to `cv::Mat::copyTo(cv::_OutputArray const&) const'
C:\Cygwin64\tmp\ccG5K8IR.o:MatchTempl.cpp:(.text$_ZN2cv3Mat6createEiii[_ZN2cv3Mat6createEiii]+0x90): undefined reference to `cv::Mat::create(int, int const*, int)'
C:\Cygwin64\tmp\ccG5K8IR.o:MatchTempl.cpp:(.text$_ZN2cv3Mat7releaseEv[_ZN2cv3Mat7releaseEv]+0x48): undefined reference to `cv::Mat::deallocate()'
C:\Cygwin64\tmp\ccG5K8IR.o:MatchTempl.cpp:(.text$_ZN2cv3MataSEOS0_[_ZN2cv3MataSEOS0_]+0xe9): undefined reference to `cv::fastFree(void*)'
collect2.exe: error: ld returned 1 exit status
mingw32-make: *** [Makefile:135: all] Error 1
If you look at the Makefile I created, the libraries that contain at least some of these functions are being linked in (e.g. cv::matchTemplate is in opencv_imgproc340). OpenCV has been reorganized since 2.4.9; notably, the external contributions produce their own libraries and are not all one object. Certain other libraries seem to have been combined with each other or removed. If you could look at MatchTempl and see which libraries are actually required it would help. What used to be there seems to be sufficient, but I link against all available libraries, which is what the Code::Blocks project seems to have been doing.