Setting up CPLEX on Windows

You can customize your installation of CPLEX for use on Microsoft Windows.

Normally, the installer you receive from IBM installs CPLEX correctly for you; this topic highlights customization for users of Microsoft Windows.

Tip:

The CPLEX library on Windows is a DLL file. The name of the CPLEX DLL looks like this: cplexXXX.dll where XXX represents the current version number.

Make sure that your application has read and execute permission for both the CPLEX DLL and the directory where it is located. In other words, set the correct authorizations on both the CPLEX DLL and the folder where it resides for your application to read and execute.

After your installation of IBM ILOG CPLEX Optimization Studio, if your applications are not able to find the DLL for CPLEX at runtime, then you may need to identify its location for them. On Windows, there are alternative ways to do so, either through the operating system or in an integrated development environment (IDE).

  • At the operating system, you can add the location of cplexXXX.dll to the environment variable PATH.

    After you extend the environment variable at the level of the operating system like this, all applications that are aware of the PATH environment variable will know where to find your CPLEX DLL. The topic Adding your CPLEX DLL to the environment variable on Windows explains this alternative in detail.

  • In Visual Studio, you can link the location of cplexXXX.dll to the properties of the project.

    After you add your CPLEX DLL to the Linker Path of your Visual Studio project like this, your Project will know where to find your CPLEX DLL. The topic Linking your CPLEX DLL to the properties of your project in Visual Studio explains this alternative in detail.

Adding your CPLEX DLL to the environment variable on Windows

  1. From the Start menu, select Control Panel.

  2. In the Control Panel, select System.

  3. In the System dialog, select the Advanced tab.

  4. On the Advanced tab, click the Environment Variables button.

  5. Add or extend the PATH environment variable. If the PATH environment variable already exists, extend it, like this:

    Name: PATH
    Value: %PATH%;C:\yourCPLEXhome\CPLEXXXX\bin\x64_windows_vsNNNN

    where XXX represents the current version number, vsNNNN represents your Visual Studio, and yourCPLEXhome represents the folder where you installed CPLEX.

  6. Restart Visual Studio and other applications for this change in the operating system to take effect.

Linking your CPLEX DLL to the properties of your project in Visual Studio

  1. In Visual Studio, right-click your project.

  2. Select Properties of the project.

  3. Among the Properties of the project, go to the Linker section.

  4. In the Linker section, add the name of the folder containing the CPLEX DLL file to the Linker Path.

  5. Save the properties of your project.