I installed OpenCV v.4.3.0 with the following commands (specifically with the BUILD_TIFF
flag turned on):
cmake -D BUILD_TIFF=ON -DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules ..
make
sudo make install
However when I try to compile in Clion I get a bunch of undefined references:
CMakeFiles/BuildingReconstruction.dir/src/file.cpp.o: In function `File::TIFFRead(std::__cxx11::basic_string<char, std::char_traits<char="">, std::allocator<char> >, cv::Mat&)':
/home/nairdap/BuildingReconstruction/src/file.cpp:24: undefined reference to `TIFFOpen'
/home/nairdap/BuildingReconstruction/src/file.cpp:29: undefined reference to `TIFFGetField'
/home/nairdap/BuildingReconstruction/src/file.cpp:30: undefined reference to `TIFFGetField'
/home/nairdap/BuildingReconstruction/src/file.cpp:31: undefined reference to `TIFFGetField'
/home/nairdap/BuildingReconstruction/src/file.cpp:32: undefined reference to `TIFFGetField'
/home/nairdap/BuildingReconstruction/src/file.cpp:33: undefined reference to `TIFFGetField'
I can ctrl-click in Clion on the references which brings me to the header file in /usr/include/x86_64-linux-gnu
and when searching I found the same header file also in my opencv directory under /home/nairdap/opencv/3rdparty/libtiff
.
My CMakeList looks as follows:
cmake_minimum_required(VERSION 3.15)
project(BuildingReconstruction)
set(CMAKE_CXX_STANDARD 14)
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS}) include_directories(data) include_directories(src)
add_executable(BuildingReconstruction data/cls.tiff data/dhm.tiff data/dsm.tiff data/dtm.tiff data/HappyFish.jpg data/tex.tiff src/anydbc.cpp src/anydbc.h src/anydbcpoint.h src/building.h src/dbscan.cpp src/dbscan.h src/dbscanpoint.h src/file.cpp src/file.h src/main.cpp src/ransac.cpp src/ransac.h src/renderer.cpp src/renderer.h)
target_link_libraries(BuildingReconstruction ${OpenCV_LIBS})
What am I missing here?