按照网站上的说明进行操作时出错 [英] Build errors while following the instructions given on a website
问题描述
您好,我尝试按照此网站上的说明进行操作 http://robotica.unileon.es/mediawiki/index.php/Objects_recognition_and_position_calculation_(网络摄像头)
在他们要求添加此内容的部分:
find_package(OpenCV "VERSION" REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
...
target_link_libraries("PROGRAM_NAME" ${OpenCV_LIBS})
我添加并尝试构建该程序包,但导致错误:
Parse error. Expected a command name, got unquoted argument with text "...".
-- Configuring incomplete, errors occurred!
make: *** [cmake_check_build_system] Error 1
Invoking "make cmake_check_build_system" failed
有人可以帮助我解决此错误吗?
这基本上描述了如何在实际使用CMake的情况下将OpenCV添加到自己的程序中. >
必须将引号中的文本替换为您的实际值/项目名称,例如,如果我的目标名为myopencvthing
,并且我想使用OpenCV 2.0或更高版本,则需要进行类似的设置:
# First tell CMake the minimal version of CMake expected
cmake_minimum_required(VERSION 2.8)
# Define a project
project(myopencvproject)
# Tell CMake to look for OpenCV 2.0 (and tell it that it's required, not optional)
find_package(OpenCV 2.0 REQUIRED)
# Tell CMake to add the OpenCV include directory for the preprocessor
include_directories(${OpenCV_INCLUDE_DIRS})
# Add the source files to a variable
set(SOURCES main.cpp processing.cpp somethingelse.cpp)
# Define the actual executable target and the source files
add_executable(myopencvthing ${SOURCES})
# Finally, add the dependencies of our executable (i.e. OpenCV):
target_link_libraries(myopencvthing ${OpenCV_LIBS})
现在,您只需要运行CMake即可创建实际的makefile或项目文件,然后构建所有内容,例如:
cd /my/build/dir
cmake /path/to/my/source
make
如果CMake无法找到指定的依赖项,则必须打开CMakeCache.txt
文件并手动编辑这些路径(或使用cmake-gui
,以防使用更直观的编辑器).
Hi i've tried following the instructions from this website http://robotica.unileon.es/mediawiki/index.php/Objects_recognition_and_position_calculation_(webcam)
At the part where they asked to add this :
find_package(OpenCV "VERSION" REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
...
target_link_libraries("PROGRAM_NAME" ${OpenCV_LIBS})
i added and tried to build the package but it resulted in the errors:
Parse error. Expected a command name, got unquoted argument with text "...".
-- Configuring incomplete, errors occurred!
make: *** [cmake_check_build_system] Error 1
Invoking "make cmake_check_build_system" failed
Could any one please help me resolve this error?
This basically describes how you're able to add OpenCV to your own program, if you're actually using CMake.
The text in quotes has to be replaced with your actual values/project names, for example, if my target is called myopencvthing
and I'd want to use OpenCV 2.0 or newer, then I'd setup something like this:
# First tell CMake the minimal version of CMake expected
cmake_minimum_required(VERSION 2.8)
# Define a project
project(myopencvproject)
# Tell CMake to look for OpenCV 2.0 (and tell it that it's required, not optional)
find_package(OpenCV 2.0 REQUIRED)
# Tell CMake to add the OpenCV include directory for the preprocessor
include_directories(${OpenCV_INCLUDE_DIRS})
# Add the source files to a variable
set(SOURCES main.cpp processing.cpp somethingelse.cpp)
# Define the actual executable target and the source files
add_executable(myopencvthing ${SOURCES})
# Finally, add the dependencies of our executable (i.e. OpenCV):
target_link_libraries(myopencvthing ${OpenCV_LIBS})
Now you'll just have to run CMake to create your actual makefiles or project files and then build everything, e.g.:
cd /my/build/dir
cmake /path/to/my/source
make
If CMake fails to find the specified dependencies, then you'll have to open the CMakeCache.txt
file and edit those paths by hand (or use cmake-gui
in case you prefer a more visual editor).
这篇关于按照网站上的说明进行操作时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!