Dlib error LNK2001 unresolved external symbol - c++

I'm currently trying to implement the DLIB library to my UWP application. I followed the Dlib compile instructions from http://dlib.net/compile.html. I generated the dlib project for "Windows Visual Studio 15 2017 Win64" and made a Release build using CMAKE.
In the project I want to use the Dlib library I added a C++ Runtime Component project and set the following properties for the project:
\...\dlib-19.9\source to VC++ Directories->Include Directories
\...\dlib-19.9\build\dlib\Release to VC++ Directories->Library Directories
dlib_release_64bit_msvc1912.lib to Linker->Input->Additional Dependencies
I've also added the following Preprocessor Definitions:
DLIB_NO_GUI_SUPPORT
DLIB_PNG_SUPPORT
DLIB_JPEG_SUPPORT
NDEBUG
But now the Runtime Component project won't compile anymore and gives me the following error:
Error LNK2001 unresolved external symbol __imp_ExitProcess in \...\dlib_release_64bit_msvc1912.lib(pngerror.obj)
When I remove the DLIB_PNG_SUPPORT from the Preprocessor Definitions it will compile, but of course it will say that I need to add DLIB_PNG_SUPPORT to the Preprocessor Definitions.
I have no clue how to solve this error. Am I doing something wrong or how can I solve this error?

Add source.cpp file from dlib/all/source.cpp directory.

Related

SCIP - SCIPOptSuite - LNK2001 - unresolved external symbol

I am new to SCIP and I encounter this problem when I tried to build the branch-and-price framework I obtained from this link.
For your reference, I use MS Visual Studio 2019. I have downloaded and installed the precompiled packages. Then, I conducted the following steps in the property of the project I built in VS 2019.
C/C++ -> General -> Additional Include Directories -> C:\Program Files\SCIPOptSuite 8.0.1\include
Linker -> Input -> C:\Program Files\SCIPOptSuite 8.0.1\lib\libsoplex.lib
Then, I build the program, and many errors (LNK2001) appear, e.g. , unresolved external symbol _imp_SCIPaddCoefLinear, etc.
I have tried to put another library in the Linker, i.e.,
Linker -> Input -> C:\Program Files\SCIPOptSuite 8.0.1\lib\libscip.lib
But, the program raises another error saying the libscip.dll is not found and I am suggested to re-install the package to fix the problem.
I have also tried to reinstall the package, but I still do not have libscip.dll in the folder of SCIPOptSuite 8.0.1.
Do you have any suggestions for properly installing and using the SCIP framework in MS Visual Studio?
Thank you in advance.
Obtained from #Richard Critten:
"...error saying the libscip.dll is not found ..." the directory containing libscip.dll need to be on the PATH or libscip.dll needs to be in the same directory as the executable.

Dlib LNK2001 unresolved external symbol USER_ERROR__inconsistent_build_configuration__see_dlib_faq_2

I am trying to implement the DLIB 19.15 library to my app. I generated the dlib project for Windows Visual Studio 15 2017 Win64 and made a Release build using CMAKE.
In the project I have added directories and additional dependencies.
But during compilation I have following error
LNK2001 unresolved external symbol USER_ERROR__inconsistent_build_configuration__see_dlib_faq_2
How Can I solve this problem?
Meet the same problem. You need to add one cpp file named dlib_path\dlib\all\source.cpp from the dlib source directory to your project and re-compile it. Do not copy it to your project path, just add it from dlib source directory.

SCIP and Visual Studi: error LNK2019

I want to solve the n-queens problem using SCIP (version 3.2.1) in Visual Studio 2010 (version 10.0.40219.1).
Source files can be found here: http://scip.zib.de/download/files/Queens.tgz
I did not write any code myself, but just included queens.hpp, scip_exceptions.hpp, queens.cpp and queens_main.cpp in my VS project.
In the project properties I did the following:
C/C++ -> General -> Additional Include Directories -> C:\scipoptsuite-3.2.1\scip-3.2.1\src\.
When building, I get errors like:
LNK2019: unresolved external symbol SCIPaddCons referenced in function "public: __thiscall cipexamples::QueensSolver::QueensSolver(unsigned int)"
I understand that I will have to link SCIP libraries to my project? But I do not know which ones and where to find them?
You need to compile the SCIP Optimization Suite first to obtain the libscipopt that you need to link to your project. It will contain everything necessary to work with SCIP.
Alternatively, you may also just use the precompiled dlls from the webpage:
http://scip.zib.de/#download

Linker Issues VS2015. LNK2019 and LNK2001 unresolved external symbol

I am trying to extend my knowledge of constrain programming and I want to build a simple example using google's or-tools in VS2015.
However I am constantly nagged by those linker errors. LNK2019 and LNK2001. Why is linking in VS so darn hard.
Google's or-tools comes in a perfect folder, with an include subfolder and lib subfolder with one single .lib file.
I have added Additional Library Dependencies.
Configuration Properties -> Linker -> General Additional Library Dependencies : C:\PATH\or-tools.VisualStudio2013-64b\lib
Set the Input under the Linker properties section.
Configuration Properties -> Linker -> Input Additional Dependencies : ortools.lib
Infomed VC++ where the include directory is.
Configuration Properties -> VC++ Directories : C:\PATH\or-tools.VisualStudio2013-64b
However it is still throwing link errors when building the solution. What am I missing here.
Thanks in advance.
edit:
spelling
Since the VS2013 and VS2015 compiler versions are incompatible, you have to build the lib from source. Though beware that this might entail a bit more work when linking with VS2015. Specifically I've had to manually resolve the following issues:
Change protobuf-3.0.0-beta-1 to protobuf-3.0.0-beta-2(bonus. not really necessary)
gflags 2.1.2 failed to compile due to a conflict of names around snprintf. To resolve this download the latest gflags version from GitHub and overwrite the one in %OR_TOOLS%\dependencies
Look up all VS solution files (.sln) in dependencies\sources\cbc-2.9.7 and convert to VS2015 format by simply double clicking them and following the instructions.
Add the following code to makefiles\Makefile.port
ifeq ("$(VisualStudioVersion)", "14.0")
VISUAL_STUDIO=2015
VS_RELEASE=v140
VS_COMTOOLS=140
else
...
endif
Replace Visual Studio 12 2013 with Visual Studio 14 2015
Rerun make third_party after each step.
Or you can just download the end result, linked on Windows 10 x64 VS2015 update 1. I've included the whole folder after running make third_party && make cc.

Linking a DLLs in visual studio 2013

I've already looked for solution, without a success.
I need to use a DLL supplied by third parties on Visual Studio 2013(running on (x64) Windows 10).
On machine there are both OpenCV 3.0.0 and OpenCV2.410 installed and working.
The DLL's author has provided a .lib file and He says that in order to use this DLLs in your project, you need to put some others OpenCV's dlls in the project folder( I've tried to put these DLLs in every project folder[yes I know, it has no sense, but after a lot of tries i've lost my patience])
What he supplies is an .dll and an example project( that doesn't work for me because it needs OpenCV2.1 and there are instructions needs to be translate in newest version [and I prefered don't translate nothing]).
The errors in this example project are of this kind:
error LNK2001: unresolved external symbol
fatal error LNK1120: unresolved externals
The most of them are caused by the miss of OpenCV2.1, that I don't want to install, because I'll have to use it on a program using with OpenCV 3.0.0.
In the example project folder there are:
The upper mentioned .dll
A .lib file
The header file .h
These DLLs: cv210.dll, cxcore210.dll, highgui210.dll, ...(eg. cv210d.dll)
What I've done is this:
A folder called "lib" where I insert all .dll, .lib, .h files.
Put the "lib" folder in Project properties>linker> General> Additional Library Directories
Writing the .lib file in properties>linker> Input> Additional Dependencies
Put the 'lib' pathproperties>C/C++>Additional Include Directories[I know, this has no sense too]
I get these kind of errors:
error LNK2001: unresolved external symbol
I've tried #pragma comment(lib, 'file.lib') way too.
Someone can help me?