第一步:修改一些IGC源文件
/******************* Changes to jpeglib.h **************************/ #ifndef JPEGLIB_H #define JPEGLIB_H /* HJH modification: added extern "C" { when __cplusplus detected */ #ifdef __cplusplus extern "C" { #endif ... /* near bottom of the file */ /* HJH modification: add closing } for extern "C" { */ #ifdef __cplusplus } #endif #endif /* JPEGLIB_H */ /******************* Changes to jmorecfg.h **************************/ /* jmorecfg.h line 160 */ /* X11/xmd.h correctly defines INT32 */ /* HJH modification: jmorecfg.h already contained a test for XMD_H and xmd.h My change adds a test for _BASETSD_H_ because the windows header file basestd.h already defines INT32 */ #if !defined(XMD_H) && !defined(_BASETSD_H_) typedef long INT32; #endif /* jmorecfg.h line 220 */ /* HJH modification: several of the windows header files already define FAR because of this, the code below was changed so that it only tinkers with the FAR define if FAR is still undefined */ #ifndef FAR #ifdef NEED_FAR_POINTERS #define FAR far #else #define FAR #endif #endif
最后需要修改jconfig.h文件
/* HJH Note: Here is one key addition that I had to make. The jpeg library uses #ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */ typedef unsigned char boolean; #endif #define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */
* a type called boolean. It defines boolean here. However, RPCNDR.H * yet another Microsoft header, also defines boolean. The ifndef * ensures that we don't attempt to redefine boolean if rpcndr.h has * already defined it. Note that we use unsigned char instead of int * like jmorecfg.h does, because we want to match what's in the SDK * header. See jconfig.vc for more info, it does the same thing. */
第二步:编译(来自IGP解压后的文件夹中的install.doc):
1. Copy jconfig.vc to jconfig.h, makelib.ds to jpeg.mak, and
makeapps.ds to apps.mak. (Note that the renaming is critical!)
2. Click on the .mak files to construct project workspaces.
(If you are using DevStudio more recent than 4.2, you'll probably
get a message saying that the makefiles are being updated.)
3. Build the library project, then the applications project.
4. Move the application .exe files from `app`/Release to an
appropriate location on your path.
5. To perform the self-test, execute the command line
NMAKE /f makefile.vc test
实际上只需要执行前三步就可以。在release文件夹中可以得到最后编译的结果jpeg.lib库文件。
第三步:在自己的代码中包含
#pragma comment(lib, "jpeg.lib")
和
#i nclude "jpeglib.h"
Done!