Ask Your Question

Revision history [back]

It looks like you are having a linker error. Did you link against the necessary libraries for the sample, which are:

  • opencv_core
  • opencv_contrib
  • opencv_imgproc
  • opencv_highgui

If you look into:

You'll see, that all of the samples can be built with a simple CMakeLists.txt. Only the following lines are relevant for you:

## Only to make sure our CMake installation 
## has the OpenCV plugin on board:
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

## Just to give the project a name:
project(facerec_cpp_samples)

## If you didn't install OpenCV into a system-wide
## search directory, you probably need to uncomment
## this (to give CMake a hint, where to search for 
## your OpenCV installation):
#SET(OpenCV_DIR /path/to/your/opencv/installation)

## This searches for your OpenCV installation and
## sets the include pathes accordingly 
find_package(OpenCV REQUIRED) 

## We'll build an executable "facerec_eigenfaces" from
## the facerec_eigenfaces.cpp. This project just consist 
## of this single source file:
add_executable(facerec_eigenfaces facerec_eigenfaces.cpp)

## And finally link against the necessary libraries. Chances
## are good, that you missed this in your setup:
target_link_libraries(facerec_eigenfaces opencv_contrib opencv_core opencv_imgproc opencv_highgui)

Just a hint: You can also build Visual Studio project files with CMake. But if you don't feel comfortable with CMake, then have a look at the tutorials on how to setup OpenCV in the documentation at:

It looks like you are having a linker error. Did you link against the necessary libraries for the sample, which are:

  • opencv_core
  • opencv_contrib
  • opencv_imgproc
  • opencv_highgui

If you look into:

You'll see, that all of the samples can be built with a simple CMakeLists.txt. Only the following lines are relevant for you:

## Only to make sure our CMake installation 
## has the OpenCV plugin on board:
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

## Just to give the project a name:
project(facerec_cpp_samples)

## If you didn't install OpenCV into a system-wide
## search directory, you probably need to uncomment
## this (to give CMake a hint, where to search for 
## your OpenCV installation):
#SET(OpenCV_DIR /path/to/your/opencv/installation)

## This searches for your OpenCV installation and
## sets the include pathes accordingly 
find_package(OpenCV REQUIRED) 

## We'll build an executable "facerec_eigenfaces" from
## the facerec_eigenfaces.cpp. This project just consist 
## of this single source file:
add_executable(facerec_eigenfaces facerec_eigenfaces.cpp)

## And finally link against the necessary libraries. Chances
## are good, that you missed this in your setup:
target_link_libraries(facerec_eigenfaces opencv_contrib opencv_core opencv_imgproc opencv_highgui)

Just a hint: You can also build Visual Studio project files with CMake. But if you don't feel comfortable with CMake, then have a look at the tutorials on how to setup OpenCV in the documentation at:OpenCV: