OpenCV - SURF functionality issue - c++

I am trying to build an OpenCV program which uses SURF matching algorithm, the code is in the following link :
http://feelmare.blogspot.ro/2011/10/sift-matching-c-source-code-using.html
However, I am obtaining 2 errors regarding some external symbols : _cvExtractSurf and _cvSURFParams.
error LNK2019: unresolved external symbol _cvExtractSURF referenced in function "public: bool __thiscall CMareMatchingClass::ExtractBGsurf(struct _IplImage *)" (?ExtractBGsurf#CMareMatchingClass##QAE_NPAU_IplImage###Z)
error LNK2019: unresolved external symbol _cvSURFParams referenced in function "public: __thiscall CMareMatchingClass::CMareMatchingClass(void)" (??0CMareMatchingClass##QAE#XZ)
Do you know how can I solve this errors? I am running the code by using opencv 2.3.0 in visual studio 2010 in Windows 7 - 64 bit.

You didn't link a needed library - try to link all OpenCV libraries in project settings. See documentation.

Related

FLAC++ Unresolved external symbols (FLAC::Encoder::Stream::State::resolved_as_cstring and FLAC::Encoder::Stream::operator bool(void) const)

I am trying to set up the FLAC++ to allow me to encode/decode audio data, but when I attempt to compile I get 2 unresolved external errors:
LNK2019 unresolved external symbol "__declspec(dllimport) public: char const * __cdecl FLAC::Encoder::Stream::State::resolved_as_cstring(class FLAC::Encoder::Stream const &)const " (_imp?resolved_as_cstring#State#Stream#Encoder#FLAC##QEBAPEBDAEBV234##Z) referenced in function "public: int __cdecl"
LNK2019 unresolved external symbol "__declspec(dllimport) public: __cdecl FLAC::Encoder::Stream::operator bool(void)const " (_imp??BStream#Encoder#FLAC##QEBA_NXZ) referenced in function "public: int __cdecl"
I am linking both the FLAC.lib and FLAC++.lib files from program files (C:\Program Files (x86)\FLAC\lib).
I have tried installing 4 different versions of FLAC (1.3.3, 1.3.4, 1.4.0 and 1.4.1) but the linking errors still persist.
Does anyone have any suggestion to why this might be happening or what I might be missing here?
Thanks!
Edit: I am using Visual Studio 2022. I have ensured that CMake is configured to generate for Visual Studio 2022, and am compiling FLAC from the same version.
Edit 2: I have solved this by downloading the library from the latest GitHub commit from (https://github.com/xiph/flac). I am unsure why, but all stable releases seem to result in the same linking errors.

unresolved external symbol _gluLookAt#72 referenced in function

I'm making a program using the glu library but when i compile i got this error:
1>opengl_3.obj : error LNK2019: unresolved external symbol _gluLookAt#72 referenced in function "public: void __thiscall OpenGLContext::setupScene(void)" (?setupScene#OpenGLContext##QAEXXZ)
I included GL/glu.h and checked if the lib and dll were present. (they are by default)
I'm using visual studio 2012.
Any idea where this error is coming from?
You are not linking to glu. Add glu to the libraries against which your program should be linked. A more detailed description can be found here.

Migration from IBM VisualAge C++ 3.6.5 to VS 2010

We're in the process of migrating 32-bit C++ application to 64-bit application (VS 2010). This application was developed 10 years back with IBM VisualAge C++ 3.6.5 for Windows. Since IBM has stopped support of this compiler, we're facing issues while migrating it to VS 2010.
This is mostly because of some missing libraries.
Sample errors:
error LNK2019: unresolved external symbol __uopen referenced in function "int __cdecl allocate_heap_storage_(void)" (?allocate_heap_storage##YAHXZ)
error LNK2019: unresolved external symbol __ucreate referenced in function "int __cdecl allocate_heap_storage_(void)" (?allocate_heap_storage##YAHXZ)
error LNK2019: unresolved external symbol __udestory referenced in function "int __cdecl deallocate_heap_storage_(void)" (?deallocate_heap_storage##YAHXXZ)
error LNK2019: unresolved external symbol __uclose referenced in function "int __cdecl deallocate_heap_storage_(void)" (?deallocate_heap_storage##YAHXXZ)
error LNK2019: unresolved external symbol __umalloc referenced in function "int __cdecl alloc_share_mem_(int,int)" (?alloc_share_mem#YAPAXHH#Z)
The above functions are defined in umalloc.h but we are missing the definitions.
How can we resolve this?
For the errors above, these function "_ucreate",_udestory , _uclose,_umalloc" are not found when linking, I think these functions were in the run time libraries provided by Visual Age. if you can find the lib files of the these run time libraries, you can put them in the input of link, it may pass the compiling phase, but may fail to launch.
One suggestion here is to replace the functions above with windows functions. All the functions above are related with memory allocations.

Trying to use my project with external opencv

I'm attaching some external libraries to my project in C++.
These libraries make use of the opencv2 libraries.
I already added the opencv2 include files to my c/c++ properties. I also added all the relevant lib files which I googled and found to the Linker input list. (I'm running the release version, but I also tried the debug version with the "d" extension).
opencv_core230.lib
opencv_highgui230.lib
opencv_objdetect230.lib
opencv_imgproc230.lib
opencv_ml230.lib
opencv_legacy230.lib
opencv_video230.lib
I'm getting these 4 annoying linking problems regarding the setSVMDetector#HOGDescriptor.
I looked everywhere for a solution and couldn't find one.; no one really uses the setSVM function in the external program.
Here are the linking problems:
Error 14 error LNK2001: unresolved external symbol "public: virtual void __thiscall cv::HOGDescriptor::setSVMDetector(class cv::_InputArray const &)" (?setSVMDetector#HOGDescriptor#cv##UAEXABV_InputArray#2##Z) C:\Users\idan\Documents\Visual Studio 2010\GraspTestingTool\GraspTestingTool\GraspTestingTool.obj GraspTestingTool
Error 15 error LNK2001: unresolved external symbol "public: virtual void __thiscall cv::HOGDescriptor::setSVMDetector(class cv::_InputArray const &)" (?setSVMDetector#HOGDescriptor#cv##UAEXABV_InputArray#2##Z) C:\Users\idan\Documents\Visual Studio 2010\GraspTestingTool\GraspTestingTool\htmlGenerator.obj GraspTestingTool
Error 16 error LNK2001: unresolved external symbol "public: virtual void __thiscall cv::HOGDescriptor::setSVMDetector(class cv::_InputArray const &)" (?setSVMDetector#HOGDescriptor#cv##UAEXABV_InputArray#2##Z) C:\Users\idan\Documents\Visual Studio 2010\GraspTestingTool\GraspTestingTool\sequenceTests.obj GraspTestingTool
Error 17 error LNK2001: unresolved external symbol "public: virtual void __thiscall cv::HOGDescriptor::setSVMDetector(class cv::_InputArray const &)" (?setSVMDetector#HOGDescriptor#cv##UAEXABV_InputArray#2##Z) C:\Users\idan\Documents\Visual Studio 2010\GraspTestingTool\GraspTestingTool\Utilities.obj GraspTestingTool
Does anyone know how to solve this issue?
Thanks a lot!
Error is due to not adding specifice library in debug or releas mode.
use 32 bit or 64 library depending on your target machine
Add respective library of opencv in release mode -
opencv_core242.lib opencv_highgui242.lib opencv_imgproc242.lib opencv_ml242.lib
opencv_legacy242.lib opencv_video242.lib
OR If you want run program in debug mode then
use debug lib of opencv
opencv_core220d.lib
opencv_highgui220d.lib
opencv_video220d.lib
opencv_ml220d.lib
opencv_legacy220d.lib
opencv_imgproc220d.lib
opencv_objdetect242.lib
C:\opencv\build\x86\vc10\lib
Add the library file "opencv_objdetect248.lib; opencv_objdetect248d.lib;" in Project roperties-->Linker-->Input.
You need to add opencv_objdetect library. If you using debug mode add objdetect(version)d.lib, however, if you release mode add objdetect(version).lib

Linking Lua with Visual Studio 2010

We use Lua (www.lua.org) script to let users to customize our server software written in C++.
At the moment we are porting the 32 bits Windows version of our project to Visual Studio 2010.
Once everything works fine with VS 2008, we thought that we would have no problem on upgrade process.
Unfortunately whenever we tried to link the lualib (as dll) to our project in VS 2010, the lua functions could not be found by the linker (the error messages are displayed below).
It seems that some calling convention is wrong on 2010, like the application may be looking for the lua functions with a prefix '_'.
To access lua functions (written in C) from our project modules (C++) we use this:
extern "C" {
#include "lua/src/lua.h"
#include "lua/src/lualib.h"
#include "lua/src/lauxlib.h"
}
The same project compiles and links with lualib successfully on VS 2008 and Linux (g++).
Could anybody help me with this ?
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__luaL_openlibs referenced in function "public: int __thiscall DsCScriptEngine::Init(void)" (?Init#DsCScriptEngine##QAEHXZ)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__luaL_newstate referenced in function "public: int __thiscall DsCScriptEngine::Init(void)" (?Init#DsCScriptEngine##QAEHXZ)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_close referenced in function "public: void __thiscall DsCScriptEngine::Shutdown(void)" (?Shutdown#DsCScriptEngine##QAEXXZ)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_pcall referenced in function "public: long __thiscall DsCScriptEngine::Execute(char const *)" (?Execute#DsCScriptEngine##QAEJPBD#Z)
etc.
The reported missing names are correct, this not a compile problem. You must be linking the wrong .lib. The name you use sounds wrong, it isn't "lualib", the current version of the import library is named lua5.1.lib (or lua51.lib, not sure what the difference is). Download it from here.