Is there anyone who succeed to include libjpeg in some compiler? I tried everything: Dev C++, VS10, CodeBlocks, copy the headers and the lib by hand, add with the linker but nothing. Right now I am really confisued as there is not an official guide on how to compile it in any compiler. I would be really happy if someone could provide a tutorial on how the library can be compiled in any compiler. Thank you in advance.
Here is how I've built libjpeg using MinGW on Windows :
I've got a copy from http://sourceforge.net/projects/mingw/. Quoting from www.mingw.org :
MSYS is a collection of GNU utilities such as bash, make, gawk and grep to allow building of applications and programs which depend on traditionally UNIX tools to be present.
We will need it to run the configure
script that comes with libjpeg sources.
From http://www.ijg.org/, take the Unix format package (the Windows one won't work with this procedure). I took the jpeg_8d
version.
I've made a temporary directory named tmp
in D:\
, but you could choose whatever suits your needs. The thing that matters is the name of paths in MSYS. As it brings some * Unixity * to Windows, paths cannot be used in their original form.
In a nutshell:
C:\path\to\file
becomes /c/path/to/file
in MSYS land, an so
D:\tmp
becomes /d/tmp
.
Decompress the libjpeg sources in D:\tmp
, so you have a jpeg-8d
directory in there.
Create a jpeg-build
directory inside D:\tmp
, it will hold the built library.
Now everything is ready for the build.
That is the mantra of building in Unix land. An option should be added to redirect the install process to D:\tmp\jpeg-build
.
Run the following commands in an MSYS shell (also named MinGW shell in Windows start menu):
cd /d/tmp/jpeg-8d
./configure --prefix=/d/tmp/jpeg-build
make
make install
As an additional step, you can run make test
for safety.
These commands will build both static and shared versions of libjpeg.
If everything runs fine, you can delete the D:\tmp\jpeg-8d
directory, but keep the jpeg-build
one. It contains:
include
directory, containing libjpeg headers. You can move them to your compiler's headers directory.lib
directory, with .a
file to pass to the linker. You can move them to your compiler's library directory.bin
directory, holding the libjpeg shared library libjpeg-8.dll
and jpeg tools.share
directory, containing man
pages for the jpeg tools.You can now build your program and link it against libjpeg by indicating the right include and library paths.
You can find many details about the libjpeg building and installation process in install.txt
inside the source package.
I hope this will be useful.