title: unresolved external symbols when building project in Visual Studios 2010 with openCV
body: <p>I'm trying to build a project with openCV, but I'm getting the following errors:</p>
  
  <pre><code>1&gt;------ Build started: Project: ZERO_CHECK, Configuration: Debug Win32 ------
  1&gt;  Checking Build System
  1&gt;  CMake does not need to re-run because C:/Users/Kevin/ROBOSLAM/build/CMakeFiles/generate.stamp is up-to-date.
  1&gt;  CMake does not need to re-run because C:/Users/Kevin/ROBOSLAM/build/examples/CMakeFiles/generate.stamp is up-to-date.
  1&gt;  CMake does not need to re-run because C:/Users/Kevin/ROBOSLAM/build/examples/opencv/CMakeFiles/generate.stamp is up-to-date.
  2&gt;------ Build started: Project: ratslam, Configuration: Debug Win32 ------
  3&gt;------ Build started: Project: ratslam_graphics, Configuration: Debug Win32 ------
  3&gt;  Building Custom Rule C:/Users/Kevin/ROBOSLAM/CMakeLists.txt
  3&gt;  CMake does not need to re-run because C:\Users\Kevin\ROBOSLAM\build\CMakeFiles\generate.stamp is up-to-date.
  3&gt;  RatslamGraphics.cpp
  2&gt;  Building Custom Rule C:/Users/Kevin/ROBOSLAM/CMakeLists.txt
  2&gt;  CMake does not need to re-run because C:\Users\Kevin\ROBOSLAM\build\CMakeFiles\generate.stamp is up-to-date.
  2&gt;  Experience_Map.cpp
  2&gt;  Pose_Cell_Network.cpp
  3&gt;     Creating library C:/Users/Kevin/ROBOSLAM/build/Debug/ratslam_graphics.lib and object C:/Users/Kevin/ROBOSLAM/build/Debug/ratslam_graphics.exp
  3&gt;RatslamGraphics.obj : error LNK2019: unresolved external symbol "public: __thiscall cv::Exception::Exception(int,class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt; const &amp;,class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt; const &amp;,class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt; const &amp;,int)" (??0Exception@cv@@QAE@HABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@00H@Z) referenced in function "public: __thiscall cv::Mat::Mat(int,int,int,void *,unsigned int)" (??0Mat@cv@@QAE@HHHPAXI@Z)
  3&gt;RatslamGraphics.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall cv::Exception::~Exception(void)" (??1Exception@cv@@UAE@XZ) referenced in function "public: __thiscall cv::Mat::Mat(int,int,int,void *,unsigned int)" (??0Mat@cv@@QAE@HHHPAXI@Z)
  3&gt;RatslamGraphics.obj : error LNK2019: unresolved external symbol "void __cdecl cv::error(class cv::Exception const &amp;)" (?error@cv@@YAXABVException@1@@Z) referenced in function "public: __thiscall cv::Mat::Mat(int,int,int,void *,unsigned int)" (??0Mat@cv@@QAE@HHHPAXI@Z)
  3&gt;RatslamGraphics.obj : error LNK2019: unresolved external symbol "void __cdecl cv::fastFree(void *)" (?fastFree@cv@@YAXPAX@Z) referenced in function "public: __thiscall cv::Mat::~Mat(void)" (??1Mat@cv@@QAE@XZ)
  3&gt;RatslamGraphics.obj : error LNK2019: unresolved external symbol "public: void __thiscall cv::Mat::deallocate(void)" (?deallocate@Mat@cv@@QAEXXZ) referenced in function "public: void __thiscall cv::Mat::release(void)" (?release@Mat@cv@@QAEXXZ)
  3&gt;RatslamGraphics.obj : error LNK2019: unresolved external symbol "public: __thiscall cv::VideoWriter::VideoWriter(void)" (??0VideoWriter@cv@@QAE@XZ) referenced in function "public: __thiscall ratslam::RatslamGraphics::RatslamGraphics(class boost::property_tree::basic_ptree&lt;class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt;,class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt;,struct std::less&lt;class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt; &gt; &gt; &amp;,class irr::IEventReceiver *,class ratslam::Ratslam *)" (??0RatslamGraphics@ratslam@@QAE@AAV?$basic_ptree@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@U?$less@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@property_tree@boost@@PAVIEventReceiver@irr@@PAVRatslam@1@@Z)
  3&gt;C:\Users\Kevin\ROBOSLAM\build\Debug\ratslam_graphics.dll : fatal error LNK1120: 6 unresolved externals
  2&gt;..\src\ratslam\Pose_Cell_Network.cpp(716): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
  2&gt;          C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\stdio.h(218) : see declaration of 'fopen'
  2&gt;  Visual_Template_Match.cpp
  2&gt;..\src\ratslam\Visual_Template_Match.cpp(127): warning C4018: '&lt;' : signed/unsigned mismatch
  2&gt;  Ratslam.cpp
  2&gt;  Generating Code...
  2&gt;c:\users\kevin\roboslam\src\ratslam\experience_map.cpp(277): warning C4715: 'ratslam::Experience_Map::dijkstra_distance_between_experiences' : not all control paths return a value
  2&gt;     Creating library C:/Users/Kevin/ROBOSLAM/build/Debug/ratslam.lib and object C:/Users/Kevin/ROBOSLAM/build/Debug/ratslam.exp
  2&gt;  ratslam.vcxproj -&gt; C:\Users\Kevin\ROBOSLAM\build\Debug\ratslam.dll
  4&gt;------ Build started: Project: ratslam_opencv_example, Configuration: Debug Win32 ------
  4&gt;  Building Custom Rule C:/Users/Kevin/ROBOSLAM/examples/opencv/CMakeLists.txt
  4&gt;  CMake does not need to re-run because C:\Users\Kevin\ROBOSLAM\build\examples\opencv\CMakeFiles\generate.stamp is up-to-date.
  4&gt;  main.cpp
  4&gt;C:\Users\Kevin\ROBOSLAM\libraries\OpenCV2.3\build\include\opencv2/flann/logger.h(70): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
  4&gt;          C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\stdio.h(218) : see declaration of 'fopen'
  4&gt;..\..\..\examples\opencv\main.cpp(97): warning C4101: 'time_s' : unreferenced local variable
  4&gt;..\..\..\examples\opencv\main.cpp(97): warning C4101: 'last_time_s' : unreferenced local variable
  4&gt;     Creating library C:/Users/Kevin/ROBOSLAM/build/examples/opencv/Debug/ratslam_opencv_example.lib and object C:/Users/Kevin/ROBOSLAM/build/examples/opencv/Debug/ratslam_opencv_example.exp
  4&gt;main.obj : error LNK2019: unresolved external symbol "void __cdecl cv::fastFree(void *)" (?fastFree@cv@@YAXPAX@Z) referenced in function "public: __thiscall cv::Mat::~Mat(void)" (??1Mat@cv@@QAE@XZ)
  4&gt;main.obj : error LNK2019: unresolved external symbol "public: void __thiscall cv::Mat::deallocate(void)" (?deallocate@Mat@cv@@QAEXXZ) referenced in function "public: void __thiscall cv::Mat::release(void)" (?release@Mat@cv@@QAEXXZ)
  4&gt;main.obj : error LNK2019: unresolved external symbol "public: __thiscall cv::VideoCapture::VideoCapture(void)" (??0VideoCapture@cv@@QAE@XZ) referenced in function _main
  4&gt;main.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall cv::VideoCapture::~VideoCapture(void)" (??1VideoCapture@cv@@UAE@XZ) referenced in function _main
  4&gt;main.obj : error LNK2019: unresolved external symbol "public: virtual bool __thiscall cv::VideoCapture::open(class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt; const &amp;)" (?open@VideoCapture@cv@@UAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function _main
  4&gt;main.obj : error LNK2019: unresolved external symbol "public: virtual bool __thiscall cv::VideoCapture::isOpened(void)const " (?isOpened@VideoCapture@cv@@UBE_NXZ) referenced in function _main
  4&gt;main.obj : error LNK2019: unresolved external symbol "public: virtual bool __thiscall cv::VideoCapture::grab(void)" (?grab@VideoCapture@cv@@UAE_NXZ) referenced in function _main
  4&gt;main.obj : error LNK2019: unresolved external symbol "public: virtual bool __thiscall cv::VideoCapture::retrieve(class cv::Mat &amp;,int)" (?retrieve@VideoCapture@cv@@UAE_NAAVMat@2@H@Z) referenced in function _main
  4&gt;C:\Users\Kevin\ROBOSLAM\build\examples\opencv\Debug\ratslam_opencv_example.exe : fatal error LNK1120: 8 unresolved externals
  5&gt;------ Skipped Build: Project: ALL_BUILD, Configuration: Debug Win32 ------
  5&gt;Project not selected to build for this solution configuration 
  ========== Build: 2 succeeded, 2 failed, 0 up-to-date, 1 skipped ==========
  </code></pre>
  
  <p>I'm using a cMake file to create the project, and it's contents are as so:</p>
  
  <pre><code>cmake_minimum_required(VERSION 2.8)
  
  project(ratslam)
  set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
  
  
  file(GLOB RATSLAM_INCLUDES src/ratslam/*.h src/ratslam/*.hpp)
  file(GLOB RATSLAM_GRAPHICS_INCLUDES src/graphics/*.h src/graphics/*.hpp)
  file(GLOB GRI_INCLUDES src/gri/*.h src/gri/*.hpp)
  file(COPY ${RATSLAM_INCLUDES};${RATSLAM_GRAPHICS_INCLUDES};${GRI_INCLUDES} DESTINATION include)
  
  include_directories("/libraries/OpenCV2.3/build")
  
  include_directories("C:/Users/Kevin/ROBOSLAM/irrlicht-1.8/include")
  link_directories("C:/Users/Kevin/ROBOSLAM/irrlicht-1.8/include")
  
  include_directories("/libraries/boost_1_53_0")
  include_directories("C:/Users/Kevin/ROBOSLAM/libraries/OpenCV2.3/build/include")
  link_directories("/libraries/boost_1_53_0")
  
  include_directories("C:/Users/Kevin/ROBOSLAM/libraries/boost_1_53_0")
  link_directories("C:/Users/Kevin/ROBOSLAM/libraries/boost_1_53_0/")
  
  link_directories("C:/Users/Kevin/ROBOSLAM/libraries/boost_1_53_0/stage/lib")
  
  
  include_directories("${CMAKE_BINARY_DIR}/include")
  add_definitions(-DRATSLAM_EXPORTS -DRATSLAM_GRAPHICS_EXPORTS)
  add_library(ratslam SHARED src/ratslam/Experience_Map.cpp src/ratslam/Pose_Cell_Network.cpp src/ratslam/Visual_Template_Match.cpp src/ratslam/Ratslam.cpp)
  target_link_libraries(ratslam ${Boost_DATE_TIME_LIBRARY})
  add_library(ratslam_graphics SHARED src/graphics/RatslamGraphics.cpp)
  target_link_libraries(ratslam_graphics Irrlicht ${OpenCV_LIBS})
  file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
  file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/include)
  file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
  
  message(STATUS "headers include ${RATSLAM_INCLUDES};${RATSLAM_GRAPHICS_INCLUDES}")
  set(RATSLAM_LIBS ratslam ratslam_graphics)
  add_subdirectory(examples)
  </code></pre>
  
  <p>It seems that all the openCV methods are causing the errors. Any idea why? I believe I imported all the libraries/header files correctly into the project, but still I get these problems. Any help/pointing me in the right direction would be great. Thanks! </p>