Link error jpeg.lib visual studio - c++

I have a Visual Studio 2012 console application project where I want to include the jpeg lib (http://www.ijg.org). I downloaded version 9b and I followed these tutorial (http://www.dahlsys.com/misc/compiling_ijg_libjpeg/index.html) .
To use the library…
I added the “Additional Include Directories” path,
I added the “Additional Library Directories” path,
and I added the name of the library to “Input -> Additional
dependencies”.
If I compile the project, I get a link error “error lnk2001 unresolved external symbol”. I spend the whole day to fix this problem. Finally, I setup a new clean VC project an included only the jpeg lib and afterwards I can compile and run the project. Does anyone know what could be the problem?

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 Studio: error LNK2001

I am trying to make the SCIP work with C++ in Windows 10.
I want to solve the VRP problem using SCIP (version 3.2.1) in Visual Studio 2010.
I have downloaded Source files and then precompiled dlls from the http://scip.zib.de and included the .hpp and cpp files in my VS project.
there was a .dll, a .exe and a .lib file in the archive.
In the project properties I did the following:
C/C++ -> General -> Additional Include Directories:
C:\scipoptsuite-3.2.1\scip-3.2.1\src\
C/C++ -> Linker -> Input-> Additional Dependencies: C:\Users\Mahla\Desktop\src\scip-3.2.1.win.x86_64.msvc.opt.spx.ld.lib;
C/C++ -> General -> Input-> Additional Library Dependencies:
C:\Users\Mahla\Desktop\src\scip-3.2.1.win.x86_64.msvc.opt.spx.ld.lib;
VC++ Directories-> Include Directories:
C:\Users\Mahla\Desktop\src;
VC++ Directories-> Library Directories:
C:\Users\Mahla\Desktop\src;
src folder is a copy of src down in the scip root directory.
I copied .dll, .lib and .exe in the Debug folder at the same level as the solution .sln file in Visual Studio.
When building, I get many errors like :
main_vrp.obj : error LNK2001: unresolved external symbol _SCIPcreateConsLinear
Can anyone tell me what is the problem or how to set up an example in VS.
Thank you very much.
I am using a x64 version of SCIP. So my "Platform" should be x64, not Win32, or it will give LNK errors.
I simply changed the platform in configuration manager to x64 and everything was okay then.

How to use libpng in Visual Studio?

I am using boost generic image library and it requires libpng. I built libpng and obtained the files libpng.lib, zlib.lib and libpngd.lib. When I tried to compile my project, Visual Studio gives a fatal error
fatal error LNK1120: 21 unresolved externals
with a bunch of unresolved external symbols like _png_set_sig_bytes and _png_read_row. What's going on here and how to solve it?
From MSDN:
https://msdn.microsoft.com/en-us/library/ba1z7822.aspx?f=255&MSPPError=-2147217396
To add .lib files as linker input in the development environment
Open the project's Property Pages dialog box. For details, see Setting Visual C++ Project Properties.
Click the Linker folder.
Click the Input property page.
Modify the Additional Dependencies property.
You must do this; explicitly specifying "libpng.lib", "zlib.lib" and "libpngd.lib" in your .exe's link command.
So this is coming from a complete simple minded moron so maybe this'll be helpful....it took me a little while to grasp. Basically, you're downloading the source code. That means, that you have to be the one to compile the source code.
Windows can compile programs that are written in C in the command prompt. You have to build the program, and it spits out a .dll or a .lib file. That or those are the files that you link to visual studio application.
You set dependencies to the header files which is usually like the source codes root folder or wherever all those .h files are.
You then set the linker to link to the .dll or .lib file(s). In Boost C++'s case, you need to link to a 'lib' folder.
I think what you need is to go over and completely grasp the basics. Here's a link from Microsoft on how Windows can compile C programs from the command prompt:
https://learn.microsoft.com/en-us/cpp/build/walkthrough-compile-a-c-program-on-the-command-line?view=vs-2019

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?