error LNK2019: unsolved external symbol? - c++

I'm working with Cplex and visual studio 2010. I have added the include and linked the .lib. I have a lot of errors like the following:
Error 1
error LNK2019: unresolved external symbol "public: void __thiscall IloAlgorithm::extract(class IloModel)const "
(?extract#IloAlgorithm##QBEXVIloModel###Z) referenced in function
_main C:\Users\yasmine\Documents\Visual Studio 2010\Projects\NursesAllocation\NursesAllocation\NursesAllocation.obj
Error 2
error LNK2019: unresolved external symbol "public: __thiscall IloCplex::IloCplex(class IloEnv)"
(??0IloCplex##QAE#VIloEnv###Z) referenced in function
_main C:\Users\yasmine\Documents\Visual Studio 2010\Projects\NursesAllocation\NursesAllocation\NursesAllocation.obj
Please, can you help me to solve this problem?

I had the same problem and I solved it including ilocplex.lib to the additional dependencies.
However, I have Cplex for Visual Studio 2008.

Related

OpenCV via NuGet packages with Visual Studio 2015, how to configure?

I'm trying to use OpenCV via NuGet packages with Visual Studio 2015 and I can't seem to get everything configured. I'm not sure if I'm making a mistake somewhere or what I'm trying is not supported.
A little background, I made this tutorial a while back:
https://www.youtube.com/watch?v=7SM5OD2pZKY
https://github.com/MicrocontrollersAndMore/OpenCV_3_Windows_10_Installation_Tutorial
And I'd like to update this to use NuGets if possible. I use NuGets on the job every day so I'm familiar with the concept, but I've only previously used NuGets with .Net (Visual Basic or C#) applications.
I'm trying to make this work with plane jane C++ OpenCV, not within a .NET or UWP app.
For the record, in a separate .Net test project, I tried the EmguCV NuGet package:
With Visual Studio 2015 and everything worked as expected (for those not familiar, Emgu CV is probably the oldest/best known/most stable .Net wrapper for OpenCV)
Here are the steps I tried to get regular C++ OpenCV to work within Visual Studio 2015 using NuGets:
Start Visual Studio 2015, make an Empty Project:
Bring up the NuGet package manager:
I choose OpenCV.Win.ImgProc as that seemed to be the only OpenCV 3.x NuGet available, this also auto imported Core as expected:
Then I added a .cpp file and copied/pasted in known-good OpenCV code, the OpenCV libraries are not recognized:
I tried Build -> Clean, Build -> Build, same concern. I also tried "Solution Configurations" and "Solution Platforms" set to Debug / Release / x86 / x64, same concern.
Am I missing a step here? Do NuGets only work within a managed environment such as .Net or UWP, or can they work with regular C++ as well? I did notice the mention in the Description about UWP:
But I'm not using VideoIO, so I'm not sure that should matter.
Has anybody had any success with this? I can always go back to the "old school" way of directly referencing libraries in Project -> (project name) Properties as shown in my tutorial linked to above, but I'd like to use NuGets if possible.
----------- Edit ---------------
I had to place my response to Leo-MSFT here to allow for enough characters and screenshots. Thanks for the suggestion Leo-MSFT, but two problems with that. For one, that package is OpenCV 2.4.10, very outdated by now:
2nd, if I use that package the red underlines are gone, but I get the following linker errors when I try to build and run:
1>------ Build started: Project: Test2, Configuration: Debug x64 ------
1> test.cpp
1>test.obj : error LNK2019: unresolved external symbol "void __cdecl cv::fastFree(void *)" (?fastFree#cv##YAXPEAX#Z) referenced in function "public: __cdecl cv::Mat::~Mat(void)" (??1Mat#cv##QEAA#XZ)
1>test.obj : error LNK2019: unresolved external symbol "public: __cdecl cv::_InputArray::_InputArray(class cv::Mat const &)" (??0_InputArray#cv##QEAA#AEBVMat#1##Z) referenced in function main
1>test.obj : error LNK2019: unresolved external symbol "public: __cdecl cv::_OutputArray::_OutputArray(class cv::Mat &)" (??0_OutputArray#cv##QEAA#AEAVMat#1##Z) referenced in function main
1>test.obj : error LNK2019: unresolved external symbol "public: void __cdecl cv::Mat::deallocate(void)" (?deallocate#Mat#cv##QEAAXXZ) referenced in function "public: void __cdecl cv::Mat::release(void)" (?release#Mat#cv##QEAAXXZ)
1>test.obj : error LNK2019: unresolved external symbol "public: void __cdecl cv::Mat::copySize(class cv::Mat const &)" (?copySize#Mat#cv##QEAAXAEBV12##Z) referenced in function "public: class cv::Mat & __cdecl cv::Mat::operator=(class cv::Mat const &)" (??4Mat#cv##QEAAAEAV01#AEBV01##Z)
1>test.obj : error LNK2019: unresolved external symbol "int __cdecl cv::_interlockedExchangeAdd(int *,int)" (?_interlockedExchangeAdd#cv##YAHPEAHH#Z) referenced in function "public: class cv::Mat & __cdecl cv::Mat::operator=(class cv::Mat const &)" (??4Mat#cv##QEAAAEAV01#AEBV01##Z)
1>test.obj : error LNK2019: unresolved external symbol "void __cdecl cv::namedWindow(class std::basic_string,class std::allocator > const &,int)" (?namedWindow#cv##YAXAEBV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##H#Z) referenced in function main
1>test.obj : error LNK2019: unresolved external symbol "int __cdecl cv::waitKey(int)" (?waitKey#cv##YAHH#Z) referenced in function main
1>test.obj : error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class std::basic_string,class std::allocator > const &,class cv::_InputArray const &)" (?imshow#cv##YAXAEBV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##AEBV_InputArray#1##Z) referenced in function main
1>test.obj : error LNK2019: unresolved external symbol "class cv::Mat __cdecl cv::imread(class std::basic_string,class std::allocator > const &,int)" (?imread#cv##YA?AVMat#1#AEBV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##H#Z) referenced in function main
1>test.obj : error LNK2019: unresolved external symbol "void __cdecl cv::GaussianBlur(class cv::_InputArray const &,class cv::OutputArray const &,class cv::Size,double,double,int)" (?GaussianBlur#cv##YAXAEBV_InputArray#1#AEBV_OutputArray#1#V?$Size_#H#1#NNH#Z) referenced in function main
1>test.obj : error LNK2019: unresolved external symbol "void __cdecl cv::Canny(class cv::_InputArray const &,class cv::_OutputArray const &,double,double,int,bool)" (?Canny#cv##YAXAEBV_InputArray#1#AEBV_OutputArray#1#NNH_N#Z) referenced in function main
1>test.obj : error LNK2019: unresolved external symbol "void __cdecl cv::cvtColor(class cv::_InputArray const &,class cv::_OutputArray const &,int,int)" (?cvtColor#cv##YAXAEBV_InputArray#1#AEBV_OutputArray#1#HH#Z) referenced in function main
1>C:\Users\cdahms\Documents\Test2\x64\Debug\Test2.exe : fatal error LNK1120: 13 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
After trying various options, I've settled on this package:
Which seems to work, although it's not very confidence inspiring that it is clearly labeled "not an official package" and also that it's slightly out of date (not many changes from OpenCV 3.1.0 to 3.2.0 however). I suppose I'll use this until a proper updated package is released.
The OpenCV libraries package is OpenCV3.1 rather than OpenCV.Win.ImgProc for your test OpenCV code.
Below is my test result, so you just need to install the OpenCV3.1 NuGet package instead of OpenCV.Win.ImgProc for that OpenCV code.
Note that: OpenCV3.1 is not an official package.

LNK2019 error using Nite and OpenNI

I haven't ever seen the error of LNK 2019 before and now I encounter it when i try to link the code that i get from Nite.
The error is...
1>kinect.obj : error LNK2019: unresolved external symbol __imp__niteShutdownHandTracker referenced in function "public: void __thiscall nite::HandTracker::destroy(void)" (?destroy#HandTracker#nite##QAEXXZ)
1>kinect.obj : error LNK2019: unresolved external symbol __imp__niteStartHandTracking referenced in function "public: enum nite::Status __thiscall nite::HandTracker::startHandTracking(class nite::Point3f const &,short *)" (?startHandTracking#HandTracker#nite##QAE?AW4Status#2#ABVPoint3f#2#PAF#Z)
1>kinect.obj : error LNK2019: unresolved external symbol __imp__niteReadHandTrackerFrame referenced in function "public: enum nite::Status __thiscall nite::HandTracker::readFrame(class nite::HandTrackerFrameRef *)" (?readFrame#HandTracker#nite##QAE?AW4Status#2#PAVHandTrackerFrameRef#2##Z)
1>kinect.obj : error LNK2019: unresolved external symbol __imp__niteHandTrackerFrameRelease referenced in function "public: void __thiscall nite::HandTrackerFrameRef::release(void)" (?release#HandTrackerFrameRef#nite##QAEXXZ)
1>kinect.obj : error LNK2019: unresolved external symbol __imp__niteStartGestureDetection referenced in function "public: enum nite::Status __thiscall nite::HandTracker::startGestureDetection(enum nite::GestureType)" (?startGestureDetection#HandTracker#nite##QAE?AW4Status#2#W4GestureType#2##Z)
1>D:\AcerUser\Documents\Visual Studio 2013\Projects\kinect\Debug\kinect.exe : fatal error LNK1120: 11 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
how to solve it?
Thanks
If you get error LNK2019 from Visual Studio Console output, you might building your project for Win32 platform on your 64bit Windows, try swiching to x64.
IF you are Using Visual Studio GO TO ->Build --> (thats where you change or create win32/x64
Configuration Manager
Are you sure your application is being linked against the corresponding libraries?
Somewhere in your OpenNI and Nite installation, there must be a folder containing .lib files. You have to specify this path in the additional library directories in your project's property page. If it still doesn't work afterwards, you should add the names of these libraries in the additional dependencies.

OpenCV - SURF functionality issue

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.

error LNK2019: unresolved external symbol _Direct3DCreate9Ex#8 referenced in function "protected: XYX()"

I am getting the following LINK error while compiling my C++ solution:
error LNK2019: unresolved external symbol _Direct3DCreate9Ex#8
referenced in function "protected: XYX()
The symbol "Direct3DCreate9Ex' is defined in "ddraw.h" header file found in "C:\Program Files\Microsoft SDKs\Windows\v7.0\Include". And verified that the header file "ddraw.h" is present in this location. Also I have included this path in VS settings "Tools-->Options-->VC++ Directories -> Includes".
But still I am getting the link error as "error LNK2019: unresolved external symbol _Direct3DCreate9Ex#8 referenced in function "protected: XYX()" ".
Can anyone kindly help me in getting rid of this link error while compiling my C++ solution.
I am using VS 2008 on 64 bit Win7.
Thanks in advance.
Based on reference page for Direct3DCreate9Ex you need to link with D3D9.lib.

VC++ 6 Linker Errors

Basically, what's happening is this: I have a VC6 workspace (contains 3 projects total), and after NOT being able to succesfully port it into VS2010, I installed XP on a virtual machine (Win 7 on host machine), and installed VS6 on the devbox.
From there, I was able to get past compilation errors, and land headfirst into a whole slew of linker errors...
and I have no idea what's wrong. If anyone could help me with this it would be tremendously appreciated!
(an excert from the build log, there's 41 linker errors total...)
>Linking...
MainFrm.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall ReportMenuBuilder::~ReportMenuBuilder(void)" (??1ReportMenuBuilder##UAE#XZ)
MainFrm.obj : error LNK2001: unresolved external symbol "public: __thiscall ReportMenuBuilder::ReportMenuBuilder(void)" (??0ReportMenuBuilder##QAE#XZ)
MainFrm.obj : error LNK2001: unresolved external symbol "public: bool __thiscall ReportMenuBuilder::Build(bool)" (?Build#ReportMenuBuilder##QAE_N_N#Z)
MainFrm.obj : error LNK2001: unresolved external symbol "public: int __thiscall CReportMultiDocTemplate::GetDocumentCount(void)const " (?GetDocumentCount#CReportMultiDocTemplate##QBEHXZ)
MainFrm.obj : error LNK2001: unresolved external symbol "public: class CString __thiscall ReportMenuBuilder::GetFilespecGivenID(unsigned int)const " (?GetFilespecGivenID#ReportMenuBuilder##QBE?AVCString##I#Z)
Only thing I can think of is apparently the projects are having trouble seeing the necessary files from the other projects, but I don't know why.
My first guess would be you haven't added the .lib file to the additional imports of the other projects. If you have dumpbin the binaries and see if you see the export.