I am trying to write a code using Google’s OR-Tools on Microsoft Visual Studio 2022.
I followed the following steps:
- Download OR-Tools from Binary on Windows on their website.
- Extracted the .zip file in D:CodeField
- Wrote the complete TSP programs of their website on VS.
- In Visual Studio, went to Project > Properties > C/C++ > Additional Include Directories
Added "D:CodeFieldor-tools_x64_VisualStudio2022_cpp_v9.5.2237include"
Clicked Apply then OK then compiled my code. - I am getting a bunch of linking errors "1>ortools.lib(scip_callback.obj) : error LNK2001: unresolved external symbol SCIPconshdlrGetData".
what should I do?
2
Answers
Visual Studio
To build and run OR-Tools on Windows, you must have Visual Studio 2019 or later installed on your computer with the C++ toolset for Visual Studio.
You can find more details here.
To build OR-Tools programs from the command line you must use a x64 Native Tools Command Prompt (not the Developer Command Prompt).
You can find more details here.
Git
Git, which can be downloaded from https://git-scm.com/.
CMake
CMake (>= 3.18), which can be downloaded from https://www.cmake.org/download. When installing CMake, select the option for a command-line accessible cmake.
.NET Core 3.1 SDK
You must install the package .NET Core 3.1 SDK version 3.1.100 or higher from the following location: sdk-3.1.425-windows-x64-installer
.Net 6.0 SDK
You must install the package .NET 6.0 SDK from the following location: sdk-6.0.403-windows-x64-installer
Download the source code
There are two distinct branches of the OR-Tools source code on GitHub: stable and main.
The stable branch has been thoroughly tested and should work flawlessly on all supported platforms.
The main branch is where the latest updates and improvements have been applied; it’s more current, but less stable.
Try adding the lib folder in linker settings and link ortools_full.lib. If there are other errors try changing the runtime library to /MD. Make sure you use C++17.