質問

i wanted to run this c++/OpenCV code that i found online:

http://docs.opencv.org/doc/tutorials/features2d/feature_homography/feature_homography.html

I have a problem with CMake, it returned this error:

CMake Error at CMakeLists.txt:5 (target_link_libraries): Cannot specify link libraries for target "SURF_Homography" which is not built by this project.

I searched on the web the solution, and i found this

CMake OpenCV Cannot Specify Link Libraries

but i can't understand why mine don't work because it looks like the same, this is my CMakeLists file:

cmake_minimum_required(VERSION 2.8)
project( SURF_Homography )
find_package( OpenCV REQUIRED )
add_executable( SURF_Homography.cpp SURF_Homography.cpp )
target_link_libraries( SURF_Homography ${OpenCV_LIBS} )

hope you can help me thanks Luca

役に立ちましたか?

解決

Change the add_executable line:

add_executable( SURF_Homography SURF_Homography.cpp )

Otherwise, the target you are specifying in the target_link_libraries line won't exist :)

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top