To create the development environment that I anticipate for my research project, I wanted to ensure that I could get Visual Studio 2017 and CPLEX 12.8.0. This project unfortunately took me the better part of a day, so I am documenting it here for my future reference and hopefully to save someone else some heartache.
To begin, I did use the material outlined in the post here. However, the post is over a year old and the method outlined there did not yield a positive result.
Step 1: Updating the path variable
As outlined here, I updated my PATH variable. I am not sure if it was absolutely necessary, as it was one of the first things I tried and was lazy to change it back.
As outlined in the steps from IBM, the PATH environment variable was already there so I added it by clicking “Edit…”. The path of the dll is specifically:
Step 2: Installing Visual Studio 2017, VC++ 2015.3 V140 toolset
If you have already installed Visual Studio 2017, you will need to re-run the Visual Studio Installer, for me it was in the Start Menu. You will need to click “Modify”. In the next menu, you will be in the “Workloads” tab. Next to “Workloads”, click “Individual Components”. Look for the header “Code Tools” under which will have the “VC++ 2015.3 V140 toolset for desktop (x86, x64)”. Ensure that toolset is checked. Click “Modify” in the lower right corner. I believe it is a big file (approximately 8Gb).
If you are installing visual studio from scratch, I believe this is a similar process when you get to the choices for “Workloads”. Choose your desired workloads and then go to the “Individual Components” tab. Look for the header “Code Tools” and ensure the “VC++ 2015.3 V140 toolset for desktop (x86, x64)” is checked.
Step 3: Linking CPLEX with your Visual Studio project
For this step, I outright copied most of the steps outlined here.
to begin, right click on the the project file and entering the project properties.
Under C/C++, General, add the following to “Additional Include directories”
C:\Program Files\IBM\ILOG\CPLEX_Studio128\cplex\include C:\Program Files\IBM\ILOG\CPLEX_Studio128\concert\include
Under Linker, General, add the following to “Additional Library Directories”
Under the “Release Configuration”
C:\Program Files\IBM\ILOG\CPLEX_Studio128\cplex\lib\x64_windows_vs2017\stat_mda C:\Program Files\IBM\ILOG\CPLEX_Studio128\concert\lib\x64_windows_vs2017\stat_mda
Under the “Debug Configuration”
C:\Program Files\IBM\ILOG\CPLEX_Studio128\cplex\lib\x64_windows_vs2017\stat_mdd C:\Program Files\IBM\ILOG\CPLEX_Studio128\concert\lib\x64_windows_vs2017\stat_mdd
Under Linker, Inpurt, add the following to “Additional Dependencies”
cplex1280.lib concert.lib ilocplex.lib
And now Visual Studio should be able to call the CPLEX environment.