Linux-based applications that call ImageGear functions may be compiled using any ANSI C or C++ compiler, though some compilers’ switch settings may be slightly different from those shown in the examples below.
To compile and link your program:
To inform the compiler of the path to your “#include” files, use the -I switch. If gear.h is in $HOME/Accusoft/ImageGear18-64/include directory, use the following specification:
Copy Code
|
|
---|---|
-I$HOME/Accusoft/ImageGear18-64/include |
Use a switch such as -L to direct the linker to the ImageGear library file, using:
Copy Code
|
|
---|---|
-L$HOME/Accusoft/ImageGear18-64/bin/ |
Use a switch such as -l to instruct the linker to the libraries to be included in the link process. You must include the ImageGear library:
Copy Code
|
|
---|---|
-lIGCORE18 |
You may need to include toolkit libraries using:
Copy Code
|
|
---|---|
-lXm -lXt |
In addition to linking with libIGCORE18.a, you must also link with the X Windows System library (libX11.a) when building GUI applications, the math library (libm.a), and the thread support library (libpthread). These libraries should be in the following order:
Copy Code
|
|
---|---|
-lIGCORE18 -lX11 -lm -lpthread |
Depending on the platform, the dynamic loader may also be required:
Copy Code
|
|
---|---|
-lIGCORE18 -lX11 -lm -lpthread –ldl |
You must also define certain flags compiler. Most, if not all, will be included by the preprocessor, but you may find it necessary to define them yourself. They are:
Copy Code
|
|
---|---|
-D_UNIX64 (all 64-bit platforms) |
The compile/link will build your application’s executable file. If you link to the shared ImageGear library, the path to that library must be included in the library path environment variable, such as LD_LIBRARY_PATH. That directs the system to the shared library files.
Starting with ImageGear for C and C++ v18.1, all supplied samples use the CMake build system. Given that CMake is installed and available, invoke:
Copy Code
|
|
---|---|
cmake <path to CMakeLists.txt> |
from the build directory to generate Makefile. Then invoke:
Copy Code
|
|
---|---|
make |
to actually build the sample.