Ask Your Question

Revision history [back]

Undeclared Identifier error, Image Stitching Tutorial

I have the same problem described in the following post (link), and the proposed solution does not work: link text

To recap: when compiling the tutorial code on image stitching link text, I get an undeclared identifier error for a reference to 'samples::findFile'. The offending line is: Mat img = imread(samples::findFile(argv[i])); and the build error is: error: use of undeclared identifier 'samples'

The accepted answer for the above linked post was to use version 4 of OpenCV. But I am using 4.3.0.4 (with CLion, on a Mac, and opencv@4 installed by brew) and I am getting the same error. Below is the content of my CMakeLists.txt:

Could this be a linker problem? Or perhaps more to do with my installation of OpenCV?

cmake_minimum_required(VERSION 3.9) project(photo_stitching_demo) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED TRUE)

find_package(OpenCV 4.3 REQUIRED PATHS /usr/local/Cellar/opencv/4.3.0_4)

include_directories(/Library/Developer/CommandLineTools/usr/include/c++/v1) include_directories(/usr/local/include) add_executable(photo_stitching_demo main.cpp)

target_link_libraries(photo_stitching_demo ${OpenCV_LIBS})