-1

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?

Mario
  • 35,726
  • 5
  • 62
  • 78
user3868279
  • 7
  • 1
  • 8
  • Ah, good. This is far more easy to interpret now compared to your squeezed-in comment. :) – Mario Jan 10 '15 at 08:45
  • @Mario Hey can you view my link:http://stackoverflow.com/questions/27889141/cannot-create-custom-message I have an error that I can't solve – WinnePoon Jan 11 '15 at 16:16
  • @Mario hey this is the last of the question that i'm gonna ask and thank you for your help so far. You've really helped me alot and i've learn quite abit from you. If possible please help me with this last question :http://stackoverflow.com/questions/28020473/how-to-output-the-following-result-to-terminal – user3868279 Jan 19 '15 at 08:28

2 Answers2

1

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).

Mario
  • 35,726
  • 5
  • 62
  • 78
0

I think you should replace "VERSION" and "PROGRAM_NAME" with the Version number and the program name. This is 2.4 for VERSION and the program name by whatever you named your executable.

Steffen
  • 2,381
  • 4
  • 20
  • 33