Mac OS CLion dyld:未加载库

时间:2018-03-07 02:43:59

标签: opencv cmake clion

该错误显示:

dyld: Library not loaded: @rpath/libopencv_xphoto.3.1.dylib
  Referenced from: /Users/zhilian/ClionProjects/untitled/cmake-build-debug/untitled
  Reason: image not found

这是我的CMakeLists.txt

cmake_minimum_required(VERSION 3.9)

project(untitled) #将untitled改为自己的工程名
find_package(OpenCV)
#或者find_package(OpenCV3)
include_directories( ${OpenCV_INCLUDE_DIRS} )

include_directories("/usr/local/Cellar/opencv/3.4.1_1/lib/")
link_directories(/usr/local/Cellar/opencv/3.4.1_1/lib/)

set(CMAKE_CXX_STANDARD 11)
set(SOURCE_FILES main.cpp)
add_executable(untitled ${SOURCE_FILES})
target_link_libraries( untitled ${OpenCV_LIBS} )

我应该在CLion上更改哪些设置?将DYLD_LIBRARY_PATH设置为环境变量对我来说不起作用,我想知道当我的应用程序运行时到底发生了什么,它可以成功编译但运行中断。

0 个答案:

没有答案