Installing CPLEX on a linux box is quite easy. I did it on Ubuntu: just download the package which is appropriate for your architecture (I downloaded a 32 bit version for x86), make sure it’s executable and sudo run it. That should be about it, unless customization is needed.
The documentation describes how to test the installation from the command line. However, I wanted to use it for C++ from within Eclipse, so I looked for the parameters in the documentation. In particular, look for the page called Setting up CPLEX for on GNU/Linux: it contains all includes, libraries, symbols, etc.
Create a C++ project (a “Hello World” is fine). Right click on the project folder or click on project and select Properties. Select C/C++ Build -> Settings -> Tool Setings (tab):
- in GCC C++ Compiler menu:
- Defined Symbols (-D) click and add “IL_STD” (without quotes)
- click and add directory path. Click on File System and select the directories. On my installation I had to add but please choose appropriate version and architecture:
- /opt/ibm/ILOG/CPLEX_StudioXYZ/cplex/include and
- Libraries (-l): add in the following order:
- Library search path (-L): click and add directory from File System (please choose appropriate version and architecture):
That’s it! Just replace your main with the example code shipped in the documentation at Using Concert Technology in C++, compile and run it