如何使用OpenCV摆脱Clion中的libgdal链接错误?

时间:2019-04-05 11:39:17

标签: c++ opencv clion

我试图在Linux上的Clion中使用OpenCV并安装了所有内容。当我尝试构建此简单程序时,出现此错误。实际上,它与sqlite无关。我做了很多尝试,但无法摆脱。

有人可以帮忙吗?

main.cpp:

#include <iostream>
#include <opencv2/opencv.hpp>

int main() {
std::cout << "Hello, World!" << std::endl;
cv::Mat img;
img = cv::imread("venedig.bmp",1);

return 0;
}

CMakeLists.txt:

cmake_minimum_required(VERSION 3.13)
project(test)

find_package(OpenCV REQUIRED)

set(CMAKE_CXX_STANDARD 14)

add_executable(test main.cpp)

target_link_libraries(test ${OpenCV_LIBS})

错误始终是:

[ 50%] Linking CXX executable test
//usr/lib/libgdal.so.20: Warning: undefined reference to »sqlite3_column_origin_name«
//usr/lib/libgdal.so.20: Warning: undefined reference to »sqlite3_column_table_name«
collect2: error: ld returned 1 exit status
CMakeFiles/test.dir/build.make:124: recipe for target 'test' failed make[3]: *** [test] Error 1
CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/test.dir/all' failed
make[2]: *** [CMakeFiles/test.dir/all] Error 2
CMakeFiles/Makefile2:84: recipe for target 'CMakeFiles/test.dir/rule' failed
make[1]: *** [CMakeFiles/test.dir/rule] Error 2
Makefile:118: recipe for target 'test' failed
make: *** [test] Error 2

0 个答案:

没有答案