在Windows中为Eclipse编译/使用libjpeg [英] Compiling/using libjpeg in Windows for Eclipse

查看:391
本文介绍了在Windows中为Eclipse编译/使用libjpeg的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此问题/答案最终将成为此问题的完整答案:



尝试使用库并在单独的项目中编译:需要帮助从libjpeg编译jpegtran.c代码



当前问题:需要帮助从libjpeg编译jpegtran.c代码

解决方案

您的建议将jconfig.h文件更新为 #define HAVE_PROTOTYPES 1 只是一个帮助更深层问题的解决方案:jconfig.h已损坏且不正确 #undef 为您的编译器支持的许多重要项目。



正确的解决方法是按照install.txt建议手动编译ckconfig.c并为它生成一个jconfig.h,然后继续制作和安装。


This question/answer will eventually serve as complete answer for this question: How can I manipulate/rotate a JPEG image in C++? Since the answers given to that question are only useful if you have already done all of this below.

I followed the guide here: Compiling libjpeg (The accepted answer guide using MINGW32 Shell)

It doesn't work despite having downloaded a fresh copy:

$ make
make  all-am
make[1]: Entering directory `/c/tmp/jpeg-9'
  CC       jaricom.lo
  CC       jcapimin.lo
jcapimin.c:127:1: error: conflicting types for 'jpeg_suppress_tables'
jcapimin.c:128:1: note: an argument type that has a default promotion can't matc
h an empty parameter name list declaration
In file included from jcapimin.c:22:0:
jpeglib.h:997:14: note: previous declaration of 'jpeg_suppress_tables' was here
make[1]: *** [jcapimin.lo] Error 1
make[1]: Leaving directory `/c/tmp/jpeg-9'
make: *** [all] Error 2

8d and 9 both do the same.

After making the change noted in this question: Compile libjpeg with mingw

Add the following definition to the jconfig.h

#define HAVE_PROTOTYPES 1

I get this output when making:

$ make
make  all-am
make[1]: Entering directory `/c/tmp/jpeg-9'
  CC       jaricom.lo
In file included from jinclude.h:20:0,
                 from jaricom.c:17:
jconfig.h:5:24: warning: extra tokens at end of #undef directive [enabled by def
ault]
  CC       jcapimin.lo
In file included from jinclude.h:20:0,
                 from jcapimin.c:21:
jconfig.h:5:24: warning: extra tokens at end of #undef directive [enabled by def
ault]
jcapimin.c:127:1: error: conflicting types for 'jpeg_suppress_tables'
jcapimin.c:128:1: note: an argument type that has a default promotion can't matc
h an empty parameter name list declaration
In file included from jcapimin.c:22:0:
jpeglib.h:997:14: note: previous declaration of 'jpeg_suppress_tables' was here
make[1]: *** [jcapimin.lo] Error 1
make[1]: Leaving directory `/c/tmp/jpeg-9'
make: *** [all] Error 2

Then you have to run "autoheader" to fix this and make again.

It supposedly made but there is nothing in my build directory set by ./configure --prefix=/c/tmp/jpeg-9-build/

I found the libjpeg-9.dll in the .lib folder within the project directory.

Messy..Now the question is: How do I use it in Eclipse?

I have the exe's in the main directory, some exe's and the DLL in the .lib sub-directory but no .lib file - How do I go about importing these into an eclipse project so that I can call functions in the DLL?

$ make install gathered the files in the build directory.

I migrated the contents of the build directory into the working Eclipse project and linked the library and include paths:

I'm not sure if this is right for how I want to use it but it's something and it compiles. Next part: Calling functions out of the DLL?

Related to using compiled jpegtran.exe: jpegtran.exe not correctly rotating image

Trying to use libraries and compile in separate project: Need help compiling jpegtran.c code from libjpeg

Current issue: Need help compiling jpegtran.c code from libjpeg

解决方案

Your advice for updating the jconfig.h file to #define HAVE_PROTOTYPES 1 is only a band-aid solution for a deeper problem: jconfig.h is corrupted and has incorrect #undef for many important items your compiler supports.

The proper way to work around this is to follow the install.txt advice to manually compile ckconfig.c and have it generate a jconfig.h for you, then proceed to make, and make install.

这篇关于在Windows中为Eclipse编译/使用libjpeg的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆