Linker error while trying to compile OpenCv file with visual studio - visual-studio

I trying to compile some OpenCv functions and I included the cvhaartraining.h from the directory C:\OpenCV2.2\modules\haartraining.
I put on Project > 'Your Project Name' Properties... > Configuration Properties > Linker > Input >
all the .lib files in the opencv library:
"C:\OpenCV2.2\lib\opencv_highgui220d.lib" "C:\OpenCV2.2\lib\opencv_core220d.lib" "C:\OpenCV2.2\lib\opencv_ml220d.lib" "C:\OpenCV2.2\lib\opencv_video220d.lib" "C:\OpenCV2.2\lib\opencv_legacy220d.lib" "C:\OpenCV2.2\lib\opencv_imgproc220d.lib" "C:\OpenCV2.2\lib\opencv_objdetect220d.lib" "C:\OpenCV2.2\lib\opencv_ts220.lib" "C:\OpenCV2.2\lib\opencv_calib3d220d.lib" "C:\OpenCV2.2\lib\opencv_contrib220d.lib" "C:\OpenCV2.2\lib\opencv_features2d220d.lib"
"C:\OpenCV2.2\lib\opencv_ffmpeg220d.lib" "C:\OpenCV2.2\lib\opencv_flann220d.lib" "C:\OpenCV2.2\lib\opencv_gpu220d.lib"
but it still won't link.
The error I get is:
vecToFiles.obj : error LNK2019: unresolved external symbol "void __cdecl cvShowVecSamples(char const *,int,int,double)" (?cvShowVecSamples##YAXPBDHHN#Z) referenced in function _main
vecToFiles.obj : error LNK2019: unresolved external symbol "int __cdecl cvCreateTrainingSamplesFromInfo(char const *,char const *,int,int,int,int)" (?cvCreateTrainingSamplesFromInfo##YAHPBD0HHHH#Z) referenced in function _main
vecToFiles.obj : error LNK2019: unresolved external symbol "void __cdecl cvCreateTestSamples(char const *,char const *,int,int,char const *,int,int,int,double,double,double,int,int,int)" (?cvCreateTestSamples##YAXPBD0HH0HHHNNNHHH#Z) referenced in function _main
vecToFiles.obj : error LNK2019: unresolved external symbol "void __cdecl cvCreateTrainingSamples(char const *,char const *,int,int,char const *,int,int,int,double,double,double,int,int,int)" (?cvCreateTrainingSamples##YAXPBD0HH0HHHNNNHHH#Z) referenced in function _main
vecToFiles\Debug\vecToFiles.exe : fatal error LNK1120: 4 unresolved externals
I think Im missing some .lib file, but I dont know which file.
Ill appreciate any help.

What extra lib files do you have? From googling it looks like it's compiled into a file called cvhaartraining.lib.

Related

LNK2001 unresolved external symbol

After compiling everything, I get those errors on Visual C++ Studio 2010.
Probably I am missing any library? If it's that can you help me to guess which one?Err
1> Creating library \Bin\Engine.lib and object \Bin\Engine.exp
1>UILoginNew.obj : error LNK2001: unresolved external symbol "public: void __thiscall boost::thread::detach(void)" (?detach#thread#boost##QAEXXZ)
1>UILoginNew.obj : error LNK2001: unresolved external symbol "private: bool __thiscall boost::thread::start_thread_noexcept(void)" (?start_thread_noexcept#thread#boost##AAE_NXZ)
1>SMCSCAN.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category#system#boost##YAABVerror_category#12#XZ)
1>UILoginNew.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category#system#boost##YAABVerror_category#12#XZ)
1>NetClient.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category#system#boost##YAABVerror_category#12#XZ)
1>StdH.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category#system#boost##YAABVerror_category#12#XZ)
1>smcPars.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category#system#boost##YAABVerror_category#12#XZ)
1>UILoginNew.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall boost::detail::thread_data_base::~thread_data_base(void)" (??1thread_data_base#detail#boost##UAE#XZ)
1>StdH.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category#system#boost##YAABVerror_category#12#XZ)
1>smcPars.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category#system#boost##YAABVerror_category#12#XZ)
1>SMCSCAN.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category#system#boost##YAABVerror_category#12#XZ)
1>\Bin\Engine.dll : fatal error LNK1120: 5 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========```
I fixed that by reinstalling Boost 1.58. 32 bits
Maybe I had x64 libs

Unresolved external symbols in object file(help.obj)

I'm compiling VLC 2.1.0 Source code in VS 2010 but getting some unresolved external symbols in help.obj file. The errors are as follows.
Error 54 error LNK2001: unresolved external symbol "public: virtual
struct QMetaObject const * __thiscall
UpdateDialog::metaObject(void)const "
(?metaObject#UpdateDialog##UBEPBUQMetaObject##XZ) D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\lib_plugin\help.obj
Error 55 error LNK2001: unresolved external symbol "public: virtual
void * __thiscall UpdateDialog::qt_metacast(char const *)"
(?qt_metacast#UpdateDialog##UAEPAXPBD#Z) D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\lib_plugin\help.obj
Error 56 error LNK2001: unresolved external symbol "public: virtual
int __thiscall UpdateDialog::qt_metacall(enum
QMetaObject::Call,int,void * *)"
(?qt_metacall#UpdateDialog##UAEHW4Call#QMetaObject##HPAPAX#Z) D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\lib_plugin\help.obj
Error 57 error LNK1120: 3 unresolved
externals D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\Release\plugins\lib_plugin.dll
I tried, Generating Meta Object file(help.moc.cpp) but it didn't help me.
Any suggestions would be appreciated. I'm new to this Win32 environment.

unresolved external symbols when building project in Visual Studios 2010 with openCV

I'm trying to build a project with openCV, but I'm getting the following errors:
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)" (??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>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>RatslamGraphics.obj : error LNK2019: unresolved external symbol "void __cdecl cv::error(class cv::Exception const &)" (?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>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>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>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<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 *)" (??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>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 *)" (?fastFree#cv##YAXPAX#Z) referenced in function "public: __thiscall cv::Mat::~Mat(void)" (??1Mat#cv##QAE#XZ)
4>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>main.obj : error LNK2019: unresolved external symbol "public: __thiscall cv::VideoCapture::VideoCapture(void)" (??0VideoCapture#cv##QAE#XZ) referenced in function _main
4>main.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall cv::VideoCapture::~VideoCapture(void)" (??1VideoCapture#cv##UAE#XZ) 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 &)" (?open#VideoCapture#cv##UAE_NABV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std###Z) referenced in function _main
4>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>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>main.obj : error LNK2019: unresolved external symbol "public: virtual bool __thiscall cv::VideoCapture::retrieve(class cv::Mat &,int)" (?retrieve#VideoCapture#cv##UAE_NAAVMat#2#H#Z) 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 ==========
I'm using a cMake file to create the project, and it's contents are as so:
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)
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!
From the error shown above I assume you are using the RatSLAM C++ libraries, and I too had the same errors during compilation in VS 2010. I was able to solve it with help from the below link :
OpenCV Build on Visual Studio LINK error
The above link says that certain lib files should be configured, like opencv_core246.lib and opencv_highgui246.lib from the OpenCV library folder. The link also leads you to a tutorial explaining how to configure them :
Setup OpenCV-2.3 for Visual Studio 2010
I hope this helps.

unresolved external symbol error when importing libraries for OpenCV2.3 in Visual Studios 2010 Express C++

first time posting a question here to stackoverflow. Sorry if I butcher the formatting!
I am attempting to follow a basic tutorial on openCV, namely this one:
http://aishack.in/tutorials/tracking-colored-objects-in-opencv/
I have looked at various tutorial online on how to install openCV, including:
Setup OpenCV-2.3 for Visual Studio 2010
and
opencv.willowgarage.com/wiki/VisualC%2B%2B
without much luck.
The current version I have running right now is OpenCV 2.3.0.
I am currently running on Windows 7 with Microsoft Visual C++ Express 2010.
Whenever I try to build and run my code, I get the following errors:
1>------ Build started: Project: Camera, Configuration: Debug Win32 ------
1>camera.obj : error LNK2019: unresolved external symbol _cvReleaseImage referenced in function "struct _IplImage * __cdecl GetThresholdedImage(struct _IplImage *)" (?GetThresholdedImage##YAPAU_IplImage##PAU1##Z)
1>camera.obj : error LNK2019: unresolved external symbol _cvInRangeS referenced in function "struct _IplImage * __cdecl GetThresholdedImage(struct _IplImage *)" (?GetThresholdedImage##YAPAU_IplImage##PAU1##Z)
1>camera.obj : error LNK2019: unresolved external symbol _cvCvtColor referenced in function "struct _IplImage * __cdecl GetThresholdedImage(struct _IplImage *)" (?GetThresholdedImage##YAPAU_IplImage##PAU1##Z)
1>camera.obj : error LNK2019: unresolved external symbol _cvCreateImage referenced in function "struct _IplImage * __cdecl GetThresholdedImage(struct _IplImage *)" (?GetThresholdedImage##YAPAU_IplImage##PAU1##Z)
1>camera.obj : error LNK2019: unresolved external symbol _cvGetSize referenced in function "struct _IplImage * __cdecl GetThresholdedImage(struct _IplImage *)" (?GetThresholdedImage##YAPAU_IplImage##PAU1##Z)
1>camera.obj : error LNK2019: unresolved external symbol _cvReleaseCapture referenced in function _main
1>camera.obj : error LNK2019: unresolved external symbol _cvWaitKey referenced in function _main
1>camera.obj : error LNK2019: unresolved external symbol _cvShowImage referenced in function _main
1>camera.obj : error LNK2019: unresolved external symbol _cvAdd referenced in function _main
1>camera.obj : error LNK2019: unresolved external symbol _cvLine referenced in function _main
1>camera.obj : error LNK2019: unresolved external symbol _cvGetCentralMoment referenced in function _main
1>camera.obj : error LNK2019: unresolved external symbol _cvGetSpatialMoment referenced in function _main
1>camera.obj : error LNK2019: unresolved external symbol _cvMoments referenced in function _main
1>camera.obj : error LNK2019: unresolved external symbol _cvQueryFrame referenced in function _main
1>camera.obj : error LNK2019: unresolved external symbol _cvNamedWindow referenced in function _main
1>camera.obj : error LNK2019: unresolved external symbol _cvCreateCameraCapture referenced in function _main
1>C:\Users\Kevin\Documents\Visual Studio 2010\Projects\Camera\Debug\Camera.exe : fatal error LNK1120: 16 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
My code is as follows:
#include "cv.h"
#include "highgui.h"
IplImage* GetThresholdedImage(IplImage* img)
{
IplImage* imgHSV = cvCreateImage(cvGetSize(img), 8, 3);
cvCvtColor(img, imgHSV, CV_BGR2HSV);
IplImage* imgThreshed = cvCreateImage(cvGetSize(img), 8, 1);
cvInRangeS(imgHSV, cvScalar(20, 100, 100), cvScalar(30, 255, 255), imgThreshed);
cvReleaseImage(&imgHSV);
return imgThreshed;
}
int main()
{
CvCapture* capture = 0;
capture = cvCaptureFromCAM(1);
if(!capture)
{
printf("Could not initialize capturing...\n");
getchar();
return -1;
}
cvNamedWindow("video");
cvNamedWindow("thresh");
IplImage* imgScribble = NULL;
while(1)
{
IplImage* frame = 0;
frame = cvQueryFrame(capture);
if(!frame)
break;
//cvErode(frame, frame, 0, 2); // ADD this line
//initalize the scribble frame if has not already been done yet
if(imgScribble == NULL)
{
imgScribble = cvCreateImage(cvGetSize(frame), 8, 3);
}
IplImage* imgYellowThresh = GetThresholdedImage(frame);
CvMoments *moments = (CvMoments*)malloc(sizeof(CvMoments));
cvMoments(imgYellowThresh, moments, 1);
// The actual moment values
double moment10 = cvGetSpatialMoment(moments, 1, 0);
double moment01 = cvGetSpatialMoment(moments, 0, 1);
double area = cvGetCentralMoment(moments, 0, 0);
// Holding the last and current ball positions
static int posX = 0;
static int posY = 0;
int lastX = posX;
int lastY = posY;
posX = moment10/area;
posY = moment01/area;
printf("position (%d,%d)\n", posX, posY);
// We want to draw a line only if its a valid position
if(lastX>0 && lastY>0 && posX>0 && posY>0)
{
// Draw a yellow line from the previous point to the current point
cvLine(imgScribble, cvPoint(posX, posY), cvPoint(lastX, lastY), cvScalar(0,255,255), 5);
}
cvAdd(frame, imgScribble, frame);
cvShowImage("thresh", imgYellowThresh);
cvShowImage("video", frame);
int c = cvWaitKey(5);
if((char)c==27 )
break;
// Release the thresholded image+moments... we need no memory leaks.. please
cvReleaseImage(&imgYellowThresh);
delete moments;
}
// We're done using the camera. Other applications can now use it
cvReleaseCapture(&capture);
cvReleaseCapture(&capture);
return 0;
}
I have installed Open CV to
C:\OpenCV2.3
I have added additional dependencies, additional directories, ect.
For the preferences for my project, they are as follows:
Additional Dependencies:
enter code here
opencv_core230.lib
opencv_highgui230.lib
opencv_legacy230.lib
opencv_video230.lib
opencv_ml230.lib
opencv_core230d.lib
opencv_highgui230d.lib
opencv_legacy230d.lib
opencv_video230d.lib
opencv_ml230d.lib
opencv_calib3d230d.lib
Aditional Library Directories:
C:\OpenCV2.3\build\x64\vc10\lib;C:\OpenCV2.3\build\x64\vc10\bin;C:\OpenCV2.3\build\x64\vc10\staticlib;%(AdditionalLibraryDirectories)
Additional Include Directories:
C:\OpenCV2.3\build\include\opencv;C:\OpenCV2.3\build\include\opencv2;C:\OpenCV2.3\build\include
I also included a path to the DLL's on my path variable for windows:
;C:\OpenCV2.3\build\x64\vc10\bin;C:\OpenCV2.3\build\bin;
I've looked at other forums, other stack overflow questions, ect without much help.
I have been trying to get this to work for the better part of a weekend. Any help would be much appreciated!
If you DID explicitly set up linking with all the necessary libraries, but linking errors still show, you might be mixing up 64/32 bit libraries and application.
I.e. make sure that all library includes point to 32 bit version of libraries if you are building 32 bit application.
I had a similar problem while I was trying to compile cvblob library (http://code.google.com/p/cvblob/) on Windows 7 32bit with Visual Studio 2010.
If everything else is done properly try my guess written below.
If not start with these tutorials:
Installing OpenCV: http://docs.opencv.org/trunk/doc/tutorials/introduction/windows_install/windows_install.html#cpptutwindowsmakeown
Configuring your projects to build and work with opencv: http://docs.opencv.org/trunk/doc/tutorials/introduction/windows_visual_studio_Opencv/windows_visual_studio_Opencv.html#windows-visual-studio-how-to.
These silimar linker errors disappeared after changing some project
properties:
In VS 2010 open Your solution
Open solution explorer (View->Solution Explorer)
Find a project that generated these linker errors. (In my example it was a project called "cvblob" inside solution called "cvBlob"
generated by cmake.)
right click on that project
From the context menu select properties
On the left select Configuration properties -> General and find a field called "Target extension"
In Project Details find your project settings for "Configuration Type"
analyse them. In my particular problem of compiling cvblob I had to set Target extension to .lib and Configuration type to
Static library. This is also a solution for guys trying to compile
cvblob library in Visual Studio 2010.
Do the same for Debug and Release version if needed.
Errors I got were:
Error 24 error LNK2019: unresolved external symbol _cvSetImageROI
referenced in function
_cvSetImageROItoBlob C:\cvblob\build\lib\cvblob.obj cvblob
Error 25 error LNK2019: unresolved external symbol _cvSaveImage
referenced in function
_cvSaveImageBlob C:\cvblob\build\lib\cvblob.obj cvblob
Error 26 error LNK2019: unresolved external symbol _cvGetImageROI
referenced in function
_cvSaveImageBlob C:\cvblob\build\lib\cvblob.obj cvblob
Error 27 error LNK2001: unresolved external symbol
_cvError C:\cvblob\build\lib\cvcolor.obj cvblob
Error 28 error LNK2019: unresolved external symbol _cvError referenced
in function _cvRenderBlob C:\cvblob\build\lib\cvblob.obj cvblob
Error 29 error LNK2001: unresolved external symbol
_cvError C:\cvblob\build\lib\cvlabel.obj cvblob
Error 30 error LNK2001: unresolved external symbol
_cvError C:\cvblob\build\lib\cvcontour.obj cvblob
Error 31 error LNK2001: unresolved external symbol
_cvError C:\cvblob\build\lib\cvtrack.obj cvblob
Error 32 error LNK2019: unresolved external symbol _cvLine referenced
in function _cvRenderBlob C:\cvblob\build\lib\cvblob.obj cvblob
Error 33 error LNK2001: unresolved external symbol
_cvLine C:\cvblob\build\lib\cvcontour.obj cvblob
Error 34 error LNK2019: unresolved external symbol _cvRectangle
referenced in function
_cvRenderBlob C:\cvblob\build\lib\cvblob.obj cvblob
Error 35 error LNK2001: unresolved external symbol
_cvRectangle C:\cvblob\build\lib\cvtrack.obj cvblob
Error 36 error LNK2019: unresolved external symbol _cvSetZero
referenced in function _cvLabel C:\cvblob\build\lib\cvlabel.obj cvblob
Error 37 error LNK2019: unresolved external symbol _cvPutText
referenced in function
_cvRenderTracks C:\cvblob\build\lib\cvtrack.obj cvblob
Error 38 error LNK2019: unresolved external symbol _cvInitFont
referenced in function
_cvRenderTracks C:\cvblob\build\lib\cvtrack.obj cvblob
Error 39 error LNK1120: 9 unresolved
externals C:\cvblob\build\lib\libs\Release\cvblob.dll cvblob
I hope it will help someone compiling cvblob library in visual studio 2010.
I had similar problem in vs10 and i have forgot to add the cv210d.lib. Adding that to project properties->configuration properties-> Linker->Input->Aditional Dependencies helped me in solving this issue. I found from the question that opencv_cv230.lib was not included in additional dependencies adding that will help solving the issue.
I Had The Same Problem, in vs10
i've missed the "opencv_core246d.lib" to add. adding it to Linker->Input->Aditional Dependencies fixed error.
This might help with the newer version.
For version 2.4.8, adding opencv_imgproc248.lib resolves the following linking error:
error LNK2019: unresolved external symbol _cvRemap referenced in function _main
error LNK2019: unresolved external symbol _cvInitUndistortMap referenced in function _main
error LNK2019: unresolved external symbol _cvFindCornerSubPix referenced in function _main
error LNK2019: unresolved external symbol _cvCvtColor referenced in function _main
for me, this error got resolved by adding two lib name explicitly under input (configuration properties-->linker-->input-->additional dependencies).
when you install opencv , based on version it will have a number appended to it. For example I have opencv2.4.13 and it has 2413 appended to all its libraries, opencv_highgui2413.lib (opencv_highgui2413d.lib for debug build ).
Now,check which libraries have the functions that were shown in errors.
highgui has cvshowimage function --> you can get this by searing it online.
http://docs.opencv.org/2.4/modules/highgui/doc/user_interface.html
Then add that lib to input and build your solution.

fatal error LNK1120: 16 unresolved externals openssl : ssleay32MD.lib,libeay32MD.lib

I am new to Openssl, and trying to run a dhclient program available online at http://www.josuegomes.com/codeblog/dhclient.htm.
While doing so I get following errors,
dhclient.cpp
1>dhclient.obj : error LNK2019: unresolved external symbol _ERR_print_errors_fp referenced in function "void __cdecl handle_error(char const *,int,char const *)" (?handle_error##YAXPBDH0#Z)
1>dhclient.obj : error LNK2019: unresolved external symbol _SSL_load_error_strings referenced in function "void __cdecl init_OpenSSL(void)" (?init_OpenSSL##YAXXZ)
1>dhclient.obj : error LNK2019: unresolved external symbol _SSL_library_init referenced in function "void __cdecl init_OpenSSL(void)" (?init_OpenSSL##YAXXZ)
1>dhclient.obj : error LNK2019: unresolved external symbol _SSL_CTX_set_cipher_list referenced in function "struct ssl_ctx_st * __cdecl setup_ctx(void)" (?setup_ctx##YAPAUssl_ctx_st##XZ)
1>dhclient.obj : error LNK2019: unresolved external symbol _SSL_CTX_new referenced in function "struct ssl_ctx_st * __cdecl setup_ctx(void)" (?setup_ctx##YAPAUssl_ctx_st##XZ)
1>dhclient.obj : error LNK2019: unresolved external symbol _TLSv1_client_method referenced in function "struct ssl_ctx_st * __cdecl setup_ctx(void)" (?setup_ctx##YAPAUssl_ctx_st##XZ)
1>dhclient.obj : error LNK2019: unresolved external symbol _SSL_CTX_free referenced in function _main
1>dhclient.obj : error LNK2019: unresolved external symbol _SSL_free referenced in function _main
1>dhclient.obj : error LNK2019: unresolved external symbol _SSL_shutdown referenced in function _main
1>dhclient.obj : error LNK2019: unresolved external symbol _SSL_read referenced in function _main
1>dhclient.obj : error LNK2019: unresolved external symbol _SSL_write referenced in function _main
1>dhclient.obj : error LNK2019: unresolved external symbol _SSL_connect referenced in function _main
1>dhclient.obj : error LNK2019: unresolved external symbol _SSL_set_bio referenced in function _main
1>dhclient.obj : error LNK2019: unresolved external symbol _SSL_new referenced in function _main
1>dhclient.obj : error LNK2019: unresolved external symbol _BIO_ctrl referenced in function _main
1>dhclient.obj : error LNK2019: unresolved external symbol _BIO_new_connect referenced in function _main
1>C:\Users\Rucha\Documents\Visual Studio 2010\Projects\emptyprojectssl\Debug\emptyprojectssl.exe : fatal error LNK1120: 16 unresolved externals
I have added includes and library paths, also my runtime library is MD and I have added ssleay32MD.lib
libeay32MD.lib to external dependencies.
Please help.
I had a similar issue and i solved.
Try to look if you are using the right libraries, i mean if you are using x64 lib and compiling with 32-bit then it will through the same error.
Happy Coding
I think the debug libs are ssleay32MDd.lib and libeay32MDd.lib (note the "d" suffix).

Resources