SCIP - SCIPOptSuite - LNK2001 - unresolved external symbol - c++

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.

Related

Linker Tools Error while configured and build wxWidgets Visual Studio 2017

Not able to configure wxwidgets in Visual Studio 2017.
Followed these steps.
From wxwidgets website, downloaded Source Code 'Windows 7Z' file, Version 3.1.3.
Run the wx_vc15.sln from build ->msw in Visual Studio 2017.
Build the Debub, DLL Debug, DLL Release, Relese successfully with Platform x86.
In Microsoft Visual Studio 17 V15.9.20, created an empty project. Added a simple wxWidgets program.
In project properties made the below changes
- In All Configurations with Platform Win32, Set the Configuration Properties -> Character Set to Use Unicode Character Set
C/C++ -> Additional Include Directories -> $(WXWIN)\include\msvc;$(WXWIN)\include;
C/C++ -> Preprocessor -> Preprocessor Defenitions -> __WXMSW__;WXUSINGDLL;_DEBUG
Linker -> Additional Library Directories -> $(WXWIN)\lib\vc_dll
Made these changes in Environment Variables
In User variables
Add a new variable WXWIN and set its value to C:\Users\varun\Desktop\workspace\wxWidgets-3.1.3.
Path -> C:\Users\varun\Desktop\workspace\wxWidgets-3.1.3\lib\vc_dll.
In project properties Release Configurations, made these changes
C/C++ -> Preprocessor -> Preprocessor Defenitions -> __WXMSW__;WXUSINGDLL;NDEBUG;
There is no code error but Linker Tools Error
Error (active) E1097 unknown attribute "no_init_all" WxWidgets_Application_5 C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\winnt.h
Error LNK2019 unresolved external symbol _main referenced in function "int __cdecl invoke_main(void)" (?invoke_main##YAHXZ) WxWidgets_Application_3 C:\Users\varun\Desktop\workspace\visual_studio_projects_2017\WxWidgets_Application_3\WxWidgets_Application_3\MSVCRTD.lib(exe_main.obj)
Error LNK1120 1 unresolved externals WxWidgets_Application_3 C:\Users\varun\Desktop\workspace\visual_studio_projects_2017\WxWidgets_Application_3\Debug\WxWidgets_Application_3.exe
What could have gone wrong?
The first error you show is not an error at all but just some IntelliSense noise, see this bug report. The real error is not being able to find _main which seems to indicate that you're building a console application (see Properties\Linker\System\SubSystem option), so it should be fixed by just making it a Windows application instead.
Also, while I don't see anything really wrong with your setup, I would still recommend using the official instructions instead. Notably in your case it should be as simple as:
If you use MSVS 2010 or later IDE for building your project, simply add wxwidgets.props property sheet to (all) your project(s) using wxWidgets. You don't need to do anything else.

Problems linking Nlopt-2.4.2 in visual studio 2017

Some back story: I am trying to get the bolt-lmm software to compile on a Windows machine, because it would be a nice addition to the research group I am in. The developers of the software have only made a linux static executeable, but made the source code available. I am used to programming in R or python, and this is my first ever encounter with C++.
I have solved a fair bit of problems, but for some reason I have not been able to get visual studio to link properly with Nlopt-2.4.2.
I downloaded it
and followed the steps given there on how to install it.
I can tell I have done the same to link the Nlopt library to the project as is described in How to add additional libraries to Visual Studio project?
I still get errors like:
Error LNK2019 unresolved external symbol __imp__nlopt_create referenced in function "public: __thiscall nlopt::opt::opt(enum nlopt::algorithm,unsigned int)" (??0opt#nlopt##QAE#W4algorithm#1#I#Z) boltCompiler C:\Users\au483192\source\repos\boltCompiled\boltCompiler\NonlinearOptMulti.obj 1
(there are a total of 12 of this type of error, and an error link 1120, which just tells me there are 12 unresolved eternals.)
I hope this is enough information to provide a hint of what is going wrong.
I did some more digging, and it seems the linker needed more than just the folder for the .lib file.
This post sums it up:
Linking a static library to my project on Visual Studio 2010
Essentially you just need to tell the linker the placement of the lib and the actual name of the .lib file.
Hopefully this will help others who forgot/did not know that added library names manually could be needed for some libraries.
TL;DR:
open configuration properties for the project > linker > general
Then add the path to the .lib file in the "addition library directories" line
Then (still in configuration properties) go to linker > input
add the .lib file name to the "addition dependencies" line, e.g. libnlopt-0.lib (don't forget to separate with ";")

Dlib error LNK2001 unresolved external symbol

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.

Visual Studio 2015 (C++) sqlite3.dll unresolved external symbol

I cannot figure out how to get sqlite3.dll (or any dll for that matter) to work with my C++ project in Visual Studio.
The error message I get is LNK2001 unresolved external symbol sqlite3_open
Here's what I did so far:
I put the .dll in myProjectFoler/Resources/sqlite3.dll
I generated sqlite3.lib using Visual Studio Developer Command Prompt using a command lib /def:sqlite3.def
I referenced the directory with the lib in Project -> Preferences -> Linker -> General -> Additional Library directories, and then referenced the .lib in Project -> Preferences -> Linker -> Input-> Additional dependencies
I placed sqlite3.h in my project and #included it
(pretty much followed the instructions seen here)
Thank you for help
The issue is that by default the header file assumes that sqlite is linked statically, as opposed to dynamic linking to a dll.
This part of sqlite3.h is responsible for that:
#ifndef SQLITE_API
# define SQLITE_API
#endif
If you set a per-project define in project properties:
SQLITE_API=__declspec(dllimport)
this should resolve your link error.
Alternatively, you can put
#define SQLITE_API __declspec(dllimport)
right before where you #include sqlite3.h.
It's difficult to tell exactly why the problem occurred. There are lots of reasons which could cause LNK2001 error. MSDN contains good check list.
You could try to use /VERBOSE option to determine which files the linker references. Put this option in Project -> Preferences -> Linker -> Command Line -> Additional Options. Output should contains similar strings:
Searching e:\SQLite\sqlite-dll-win32-x86-3150100\sqlite3.lib:
Found _sqlite3_open
Referenced in ConsoleApplication2.obj
Loaded sqlite3.lib(sqlite3.dll)
Pay attention to the VS runtime libraries, there should be no mixup between Debug and Release libraries.

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.