织梦CMS - 轻松建站从此开始!

罗索

在 VC 中编译 IJG JPEG 函数库

落鹤生 发布于 2011-04-06 20:01 点击:次 
在 VC 中编译 IJG JPEG 函数库
TAG:

第一步:修改一些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
libr
ary 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!

(gc315630)
本站文章除注明转载外,均为本站原创或编译欢迎任何形式的转载,但请务必注明出处,尊重他人劳动,同学习共成长。转载请注明:文章转载自:罗索实验室 [http://www.rosoo.net/a/201104/11171.html]
本文出处:CSDN博客 作者:gc315630
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:点击我更换图片
栏目列表
将本文分享到微信
织梦二维码生成器
推荐内容