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:
C:\Program Files\IBM\ILOG\CPLEX_Studio128\cplex\bin\x64_win64
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.
5 replies on “Using Visual Studio 2017, CPLEX 12.8.0, Windows 10”
Hi Sean.
Thanks for your post
I followed the steps, and I have this error:
Severity Code Description Project File Line Suppression State
Error C4996 ‘IloCplex::PresolveCallbackI::~PresolveCallbackI’: was declared deprecated c:\program files\ibm\ilog\cplex_studio128\cplex\include\ilcplex\ilocplexi.h 3552
I would really appreciate if you can help me solving it.
So,
I think there could be one of two things – It looks like I dod forget to add some Preprocessor definitions (C++ > Preprocessor > Preprocessor Definitions)
Under Release, x64:
NDEBUG
_CONSOLE
IL_STD
Under Debug, x64:
_DEBUG
_CONSOLE
IL_STD
In addition, a similar error pops on my computer when attempting to compile in 32 bit.
Sorry for the delay, hope this helps.
Hi,
Add the following line in your code. It should be first line of the code.
#pragma warning(disable : 4996)
Hope this helps.
Thanks.
Hi Sean,
Thanks for your post, it was really helpful.
I followed all of the configurations, still I get this error:
‘ConsoleApplication1.exe’ (Win32): Loaded ‘C:\Users\muge\source\repos\ConsoleApplication1\x64\Release\ConsoleApplication1.exe’. Symbols loaded.
‘ConsoleApplication1.exe’ (Win32): Loaded ‘C:\Windows\System32\ntdll.dll’. Symbols loaded.
‘ConsoleApplication1.exe’ (Win32): Loaded ‘C:\Windows\System32\kernel32.dll’. Symbols loaded.
‘ConsoleApplication1.exe’ (Win32): Loaded ‘C:\Windows\System32\KernelBase.dll’. Symbols loaded.
‘ConsoleApplication1.exe’ (Win32): Loaded ‘C:\Windows\System32\ucrtbase.dll’. Symbols loaded.
‘ConsoleApplication1.exe’ (Win32): Loaded ‘C:\Program Files\IBM\ILOG\CPLEX_Studio128\opl\bin\x64_win64\cplex1280.dll’. Module was built without symbols.
‘ConsoleApplication1.exe’ (Win32): Loaded ‘C:\Windows\System32\advapi32.dll’. Symbols loaded.
‘ConsoleApplication1.exe’ (Win32): Loaded ‘C:\Windows\System32\vcruntime140.dll’. Symbols loaded.
‘ConsoleApplication1.exe’ (Win32): Loaded ‘C:\Windows\System32\msvcrt.dll’. Symbols loaded.
‘ConsoleApplication1.exe’ (Win32): Loaded ‘C:\Windows\System32\sechost.dll’. Symbols loaded.
‘ConsoleApplication1.exe’ (Win32): Loaded ‘C:\Windows\System32\rpcrt4.dll’. Symbols loaded.
‘ConsoleApplication1.exe’ (Win32): Loaded ‘C:\Windows\System32\kernel.appcore.dll’. Symbols loaded.
The thread 0x4028 has exited with code 1 (0x1).
The thread 0x31c0 has exited with code 1 (0x1).
The thread 0x470c has exited with code 1 (0x1).
The program ‘[4428] ConsoleApplication1.exe’ has exited with code 1 (0x1).
Maybe you can help me for solving this problem.
Thanks again.
I can only guess that you’re using 64 bit CPLEX and trying to compile a 32 bit program. You’ll need to make that change in your configuration manager.