Tuesday, February 3, 2009

Compile and Link Gil image processing library (boost)

x_gradient.cpp

[NOTE: gcc compiles programs to use shared libraries by default on most systems, if they are available. Whenever a static library ‘libNAME.a’ would be used for linking with the option -lNAME the compiler first checks for an alternative shared library with the same name and a ‘.so’ extension. ]

To link using libjpeg.so (dynamically, by default for g++)

~Desktop/$ g++ -I/usr/local/include/boost-1_37 -ljpeg x_gradient.cpp

Alternatively, static linking can be forced with the -static option to gcc to avoid the use of shared libraries:

~Desktop/$ g++ -Wall -static -I/usr/local/include/boost-1_37 -L/usr/lib/ dynamic_image.cpp -ljpeg


Be sure to install all 'libjpeg62' 'libjpeg62-dbg' 'libjpeg62-dev' 'libjpeg-progs' through Synaptic Package Manager.

No comments: