I need a image library and I\'ve been looking into FreeImage, http://freeimage.sourceforge.net/. I want to link it statically with my application.
I have tried downl
Yes, I've been able to link FreeImage statically on several Visual studio versions. Here I describe how I do this usually.
With FreeImage, by default, we have 8 options to link it to your app:
FreeImage - dynamic link (you will need dll).
FreeImageLib - static link.
Each of these can be built with "Debug" or with "Release" configurations and for Win32 or Win64 platforms.
So, assume that we need ( Static && Win32 && Debug ) and ( Static && Win32 && Release ) variants for our app. Also in our app we use Dynamic Runtime Library (by default, FreeImage set up for static for some reason) How we usually got it:
Download and unpack fresh version (or at least clean up old distib)
Open FreeImage.2008.sln
select ALL of 10 projects with Shift+click. Then in "Project(s) Properties / C++ / Code generation" we choose /MDd for "Debug" configuration and /MD for "Release".
Then we go to "Menu / Build / Batch build", select:
FreeImageLib | Debug | Win32
FreeImageLib | Release | Win32
and press "Build".
Wait for choosen configurations built. All what we need will be copied in FreeImage\Dist
folder
in FreeImage\Dist
folder check files:
delete.me
FreeImage.h
FreeImage.lib
FreeImaged.lib
Check creation date and time. It must be fresh baked and hot. If they not, copy them from FreeImage\Source\FreeImageLib\Debug
and FreeImage\Source\FreeImageLib\Release
.
FreeImage\Dist
and link FreeImaged.lib
to Debug configurations and FreeImage.lib
to Releases.Include in source file:
#define FREEIMAGE_LIB
#include "FreeImage.h"
Try to call
FreeImage_Initialise();
FreeImage_DeInitialise();
It should work
Happy coding!