2013-02-18 3 views
0

내가 OpenCV의와 프로젝트를 구축하기 위해 노력하고있어,하지만 난 다음 오류 받고 있어요와 비주얼 스튜디오 2010에서 프로젝트를 빌드 할 때 : 나는 cMake가 파일을 사용하고되지 않은 외부 기호를 OpenCV의

1>------ Build started: Project: ZERO_CHECK, Configuration: Debug Win32 ------ 
1> Checking Build System 
1> CMake does not need to re-run because C:/Users/Kevin/ROBOSLAM/build/CMakeFiles/generate.stamp is up-to-date. 
1> CMake does not need to re-run because C:/Users/Kevin/ROBOSLAM/build/examples/CMakeFiles/generate.stamp is up-to-date. 
1> CMake does not need to re-run because C:/Users/Kevin/ROBOSLAM/build/examples/opencv/CMakeFiles/generate.stamp is up-to-date. 
2>------ Build started: Project: ratslam, Configuration: Debug Win32 ------ 
3>------ Build started: Project: ratslam_graphics, Configuration: Debug Win32 ------ 
3> Building Custom Rule C:/Users/Kevin/ROBOSLAM/CMakeLists.txt 
3> CMake does not need to re-run because C:\Users\Kevin\ROBOSLAM\build\CMakeFiles\generate.stamp is up-to-date. 
3> RatslamGraphics.cpp 
2> Building Custom Rule C:/Users/Kevin/ROBOSLAM/CMakeLists.txt 
2> CMake does not need to re-run because C:\Users\Kevin\ROBOSLAM\build\CMakeFiles\generate.stamp is up-to-date. 
2> Experience_Map.cpp 
2> Pose_Cell_Network.cpp 
3>  Creating library C:/Users/Kevin/ROBOSLAM/build/Debug/ratslam_graphics.lib and object C:/Users/Kevin/ROBOSLAM/build/Debug/ratslam_graphics.exp 
3>RatslamGraphics.obj : error LNK2019: unresolved external symbol "public: __thiscall cv::Exception::Exception(int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,int)" ([email protected]@@[email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]) referenced in function "public: __thiscall cv::Mat::Mat(int,int,int,void *,unsigned int)" ([email protected]@@[email protected]@Z) 
3>RatslamGraphics.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall cv::Exception::~Exception(void)" ([email protected]@@[email protected]) referenced in function "public: __thiscall cv::Mat::Mat(int,int,int,void *,unsigned int)" ([email protected]@@[email protected]@Z) 
3>RatslamGraphics.obj : error LNK2019: unresolved external symbol "void __cdecl cv::error(class cv::Exception const &)" ([email protected]@@[email protected]@@Z) referenced in function "public: __thiscall cv::Mat::Mat(int,int,int,void *,unsigned int)" ([email protected]@@[email protected]@Z) 
3>RatslamGraphics.obj : error LNK2019: unresolved external symbol "void __cdecl cv::fastFree(void *)" ([email protected]@@[email protected]) referenced in function "public: __thiscall cv::Mat::~Mat(void)" ([email protected]@@[email protected]) 
3>RatslamGraphics.obj : error LNK2019: unresolved external symbol "public: void __thiscall cv::Mat::deallocate(void)" ([email protected]@[email protected]@QAEXXZ) referenced in function "public: void __thiscall cv::Mat::release(void)" ([email protected]@[email protected]@QAEXXZ) 
3>RatslamGraphics.obj : error LNK2019: unresolved external symbol "public: __thiscall cv::VideoWriter::VideoWriter(void)" ([email protected]@@[email protected]) referenced in function "public: __thiscall ratslam::RatslamGraphics::RatslamGraphics(class boost::property_tree::basic_ptree<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > &,class irr::IEventReceiver *,class ratslam::Ratslam *)" ([email protected]@@[email protected][email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected][email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@[email protected]@[email protected]@@[email protected]@@[email protected]@@Z) 
3>C:\Users\Kevin\ROBOSLAM\build\Debug\ratslam_graphics.dll : fatal error LNK1120: 6 unresolved externals 
2>..\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>   C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\stdio.h(218) : see declaration of 'fopen' 
2> Visual_Template_Match.cpp 
2>..\src\ratslam\Visual_Template_Match.cpp(127): warning C4018: '<' : signed/unsigned mismatch 
2> Ratslam.cpp 
2> Generating Code... 
2>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>  Creating library C:/Users/Kevin/ROBOSLAM/build/Debug/ratslam.lib and object C:/Users/Kevin/ROBOSLAM/build/Debug/ratslam.exp 
2> ratslam.vcxproj -> C:\Users\Kevin\ROBOSLAM\build\Debug\ratslam.dll 
4>------ Build started: Project: ratslam_opencv_example, Configuration: Debug Win32 ------ 
4> Building Custom Rule C:/Users/Kevin/ROBOSLAM/examples/opencv/CMakeLists.txt 
4> CMake does not need to re-run because C:\Users\Kevin\ROBOSLAM\build\examples\opencv\CMakeFiles\generate.stamp is up-to-date. 
4> main.cpp 
4>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>   C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\stdio.h(218) : see declaration of 'fopen' 
4>..\..\..\examples\opencv\main.cpp(97): warning C4101: 'time_s' : unreferenced local variable 
4>..\..\..\examples\opencv\main.cpp(97): warning C4101: 'last_time_s' : unreferenced local variable 
4>  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>main.obj : error LNK2019: unresolved external symbol "void __cdecl cv::fastFree(void *)" ([email protected]@@[email protected]) referenced in function "public: __thiscall cv::Mat::~Mat(void)" ([email protected]@@QA[email protected]) 
4>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall cv::Mat::deallocate(void)" ([email protected]@[email protected]@QAEXXZ) referenced in function "public: void __thiscall cv::Mat::release(void)" ([email protected]@[email protected]@QAEXXZ) 
4>main.obj : error LNK2019: unresolved external symbol "public: __thiscall cv::VideoCapture::VideoCapture(void)" ([email protected]@@[email protected]) referenced in function _main 
4>main.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall cv::VideoCapture::~VideoCapture(void)" ([email protected]@@[email protected]) referenced in function _main 
4>main.obj : error LNK2019: unresolved external symbol "public: virtual bool __thiscall cv::VideoCapture::open(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" ([email protected]@[email protected]@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@Z) referenced in function _main 
4>main.obj : error LNK2019: unresolved external symbol "public: virtual bool __thiscall cv::VideoCapture::isOpened(void)const " ([email protected]@[email protected]@UBE_NXZ) referenced in function _main 
4>main.obj : error LNK2019: unresolved external symbol "public: virtual bool __thiscall cv::VideoCapture::grab(void)" ([email protected]@[email protected]@UAE_NXZ) referenced in function _main 
4>main.obj : error LNK2019: unresolved external symbol "public: virtual bool __thiscall cv::VideoCapture::retrieve(class cv::Mat &,int)" ([email protected]@[email protected]@[email protected]@[email protected]) referenced in function _main 
4>C:\Users\Kevin\ROBOSLAM\build\examples\opencv\Debug\ratslam_opencv_example.exe : fatal error LNK1120: 8 unresolved externals 
5>------ Skipped Build: Project: ALL_BUILD, Configuration: Debug Win32 ------ 
5>Project not selected to build for this solution configuration 
========== Build: 2 succeeded, 2 failed, 0 up-to-date, 1 skipped ========== 

을 프로젝트를 생성하면 그 내용은 다음과 같습니다.

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) 

모든 openCV 메소드가 오류를 일으키는 것으로 보입니다. 왜 그런가? 모든 라이브러리/헤더 파일을 프로젝트에 올바르게 가져 왔지만 여전히 이러한 문제가 발생한다고 생각합니다. 어떤 도움이나 올바른 방향으로 나를 가리키면 좋을 것입니다. 감사!

OpenCV Build on Visual Studio LINK error :

답변

1
난 당신이 RatSLAM C++ 라이브러리를 사용한다고 가정 위에 표시된 오류에서

, 내가 너무 VS 2010에서 컴파일하는 동안 같은 오류가 있었다 나는 아래 링크의 도움으로 그것을 해결할 수 있었다

위의 링크는 OpenCV 라이브러리 폴더의 opencv_core246.lib 및 opencv_highgui246.lib와 같이 특정 lib 파일을 구성해야한다고 말합니다. 링크는이를 구성하는 방법을 설명하는 튜토리얼을 안내 :

Setup OpenCV-2.3 for Visual Studio 2010

도움이 되었기를 바랍니다.