Using the Component Libraries
Examples provided with CPLEX help you check your installation.
After you have completed the installation, you can verify that everything is working by running one or more of the examples that are provided with the standard distribution.
Verifying set-up on UNIX
On
a UNIX system, go to the subdirectory examples/platform/libformat that
matches your particular platform of operating system and compiler.
In that directory, you will find a file named Makefile.
Execute one of the examples, for instance lpex1.c ,
by trying this sequence of commands:
make lpex1
lpex1
-r
This example takes one argument, either -r , -c ,
or -n .
If your interest is in running one of the C++ examples, try this sequence of commands to execute a comparable example in C++:
make ilolpex1
ilolpex1
-r
If your interest is in running one of the Java examples, try this sequence of commands:
make LPex1.class
java
-Djava.library.path=../../../bin/platform: \
-classpath ../../../lib/cplex.jar: LPex1 -r
where platform represents the machine and library format
Any of these examples, whether C, C++, or Java, should return an optimal objective function value of 202.5.
Verifying set-up on Windows
On a Windows machine, you can follow a similar process using the facilities of your compiler interface to compile and then run any of the examples. A project file for each example is provided, in a format for Microsoft Visual Studio.
To run the examples on Windows, either you must copy the CPLEX DLL file to the directory or folder containing the examples, or you must make sure that the location of the DLL file is part of your Windows path, as explained in Setting up CPLEX on Windows.
In case of errors
If
an error occurs during the steps to make or to compile,
then check that you are able to access the compiler and the necessary
linker/loader files and system libraries. If an error occurs on the
next step, when executing the program created by make,
then the nature of the error message will guide your actions. For
Windows users, if the program has trouble locating cplex XXX .dll
or ILOG.CPLEX.dll, make sure the DLL file is stored
either in the current directory or in a directory listed in your PATH environment
variable.
The UNIX Makefile, or Windows project
file, contains useful information regarding recommended flags and
other settings for compilation and linking.
Compiling and linking your own applications
The source files for the examples and the makefiles provide guidance for how your own application can call CPLEX. The following topics give more specific information about the necessary header files for compilation, and how to link CPLEX and Concert Technology libraries into your application.
C++ tutorial contains information and platform-specific instructions for compiling and linking the Concert Technology Library, for C++ users.
Java tutorial contains information and platform-specific instructions for compiling and linking the Concert Technology Library, for Java users.
.NET tutorial offers an example of a C#.NET application.
Callable Library tutorial contains information and platform-specific instructions for compiling and linking the Callable Library.
Python tutorial contains information about using conventional Python utilities, such as
disutils, and instructions for launching an interactive Python session.