How to: Configure MS Visual Studio to use IBM CPLEX Concert

In this tutorial I will describe how to configure Microsoft Visual Studio Express to use IBM CPLEX with Concert technology in a C++ project. This tutorial assumes you already have CPLEX installed. If this is not the case, follow the How to Download and Install a full version of CPLEX. If you’re looking for how to use CPLEX with Apple Xcode, follow the How to configure IBM CPLEX with Apple Xcode.

First, open MS Visual Studio and start a new C++ console application. You might want to see How to Install Visual Studio and Create a C++ project.

When your project is created, right click “Project” and select “Properties”.

properties

Go through Configuration Properties – C/C++ – General. You will want to edit the “Additional Include Directories”.

properties c++

Here you need to add the full path to the include directories of CPLEX and CONCERT. Under my Windows system, these look like the following image.

cplex 4 includes

Then, still under the C/C++ properties, navigate to the Preprocessor menu and edit it to look like the following:

cplex 5 preprocessor

Now, edit the Linker – General – Additional Library Directories.

cplex 6 linker libraries

And add the folders corresponding to your system and platform. In my case it is Visual Studio 2012 64 bits.

cplex 7 libraries

You also need to edit the Linker – Input – Additional Dependencies

cplex 8 input

And add the following information (once again, I have installed CPLEX 12.6.1, the latest version as of writing).

cplex 9 libs

The procedure is the same if you have other versions of CPLEX or if you use Visual Studio 2010 or 2013. These are all supported by CPLEX 12.6.1.

Now you can import an example from CPLEX or code your own model/algorithm. Enjoy!

You might want to see How to Install MS Visual Studio and How to Download and Install a full version of IBM CPLEX.

Thanks to Mahdi Khemakhem and Rahma Lahyani.

This was useful? Buy me a cup of coffee to help me keep this website running!





Published by

Leandro Coelho

Was this useful? Pay me a coffee to help me keep this site running.