Linking staticlib in mvs2013 release gives external errors [closed]
I have multiple errors LNK2001: unresolved external symbol error "opencv_highgui2413.lib(cap_vfw.obj) when i try to use the staticlib folder instead of lib and dlls in mvs2013 windows 10 and release option in project build. The statilib i am trying to use is opencv-2.4.13.exe
- By C/C++ linking the include directory to : D:\OpenCV\build\include
- By Linker linking the include dependancies to : D:\OpenCV\build\x86\vc12\staticlib And using : No Incremental linking
- By Linker input additional dependancies entering each one .lib inside the folder of staticlib without "d"
- By C/C++ using runtime library to : Multi-Threaded(/MT)
Is there anything i do wrong or is it something else ? Windows 10 - mvs2013 - The project i create to test is only a VideoCapture webcam test
My Test project is working fine if i dont use the staticlib and use the lib with dlls but since i want a staticlib i test it with the above linkings of opencv and it has errors in every function of object opecv_highgui2413.lib
Thanks in advance for any kind of help to solve this issue
@LBerger request :
C/C++ command line /GS /GL /analyze- /W3 /Gy /Zc:wchar_t /I"D:\OpenCV\build\include"/Zi /Gm- /O2 /Fd"Release\vc120.pdb" /fp:precise /D "WIN32" /D "_CONSOLE" /D "_LIB" /D "_UNICODE" /D "UNICODE" /errorReport:prompt /WX- /Zc:forScope /Gd /Oy- /Oi /MT /Fa"Release\" /EHsc /nologo /Fo"Release\" /Fp"Release\TestVideo.pch"
LINKER command line /OUT:"D:\TestVideo\Release\TestVideo.exe" /MANIFEST /LTCG /NXCOMPAT /PDB:"D:\TestVideo\Release\TestVideo.pdb" /DYNAMICBASE "opencv_calib3d2413.lib" "opencv_contrib2413.lib" "opencv_core2413.lib" "opencv_features2d2413.lib" "opencv_flann2413.lib" "opencv_gpu2413.lib" "opencv_highgui2413.lib" "opencv_imgproc2413.lib" "opencv_legacy2413.lib" "opencv_ml2413.lib" "opencv_nonfree2413.lib" "opencv_objdetect2413.lib" "opencv_ocl2413.lib" "opencv_photo2413.lib" "opencv_stitching2413.lib" "opencv_superres2413.lib" "opencv_ts2413.lib" "opencv_video2413.lib" "opencv_videostab2413.lib" "IlmImf.lib" "libjasper.lib" "libjpeg.lib" "libpng.lib" "libtiff.lib" "zlib.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /DEBUG /MACHINE:X86 /OPT:REF /SAFESEH /INCREMENTAL:NO /PGD:"D:\TestVideo\Release\TestVideo.pgd" /SUBSYSTEM:CONSOLE /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"Release\TestVideo.exe.intermediate.manifest" /OPT:ICF /ERRORREPORT:PROMPT /NOLOGO /LIBPATH:"D:\OpenCV\build\x86\vc12\staticlib" /TLBID:1
And Here is the small test which work with dynamic built of openv and not with static maby could help someone to help me out :
#include <iostream>
#include "opencv2/opencv.hpp"
using namespace cv;
using namespace std;
int main(){
Mat CamFrame;
VideoCapture CaptureCam(CV_CAP_ANY);
..... alla others not needed cause even with VideoCapture it pops up all errors
..... if i remove VideoCapture no errors at all it builds in release mode and static opencv with all libs inside
return 0;
}
@LBerger yes it builds it without errors but it doesn`t show the image at all, it opens the window and stays with gray backroung and no image is loaded inside, the image is on the same folder with my executable so it has something to ...
Can you insert in your post command line and link line (in project properties )
@LBerger i updated my quesion with your request. I can provide also the unresolved external on "opencv_highgui2413.lib(cap_vfw.obj)" library which functions had the errors on
It doesn`t compile with any version i downloaded, it always pops up the same unresolved external about (cap_vfw.obj) inside the opencv_highgui2413.lib ... any suggestion ?
in your cmd line you have /MACHINE:X86. is Opencv 2.4.13 in x86?
yes thats for sure, i havent test the debug static though, cause i need to implement it after my tests to a solution that need to be build in release mode, but i will try the debug later just to see if it has something to do with the release option instead of the debug.
I have tested also the staticlib in debug mode with the debug .libs also has the same 20 errors refering to the openv_highgui2413d.lib(cap_vfw.obj), it has something to do with the staticlib and this lib. Do i need to use included headers or any other files from opencv inside my project except the libs ?
Can you give full path to lib in your link command line?
Make a small program like main()[Mat x; return;} and link with core and imgproc. when it works add in source VideoCapture and libs...
@LBerger. yes if i remove the VideoCapture it builds in static with Mat and all the libs included with no errors. When i enter the Videocapture cap(CV_CAP_ANY); it pops up all the 20 errors. Do i need to define or redefine anything else from higigui.hpp into my cpp file in order to work with static mode ? The problem seems to be in the highgui.lib when in static build
try something like this
can you give full error messages