如何构建这个项目?(jpeg 库) [英] How to build this project? (jpeg lib)
问题描述
我现在使用 http://code.google.com/p/jpeg-compressor/ 所以我不再关心让这个工作了.
im now using http://code.google.com/p/jpeg-compressor/ so i dont care about making this work anymore.
我下载了 http://ijg.org/ 源代码,我尝试将其构建为 DLL 文件.这是我能建造的最远的地方,直到我进入死胡同.
I downloaded the http://ijg.org/ source code, i tried to build it as a DLL file. This is farthest i could build until i went into dead-end.
我注意到有一些 .c 文件我不得不删除,但我不知道我是否删除了正确的文件,至少有这些文件 jmemmac.c
和 jmemdos.c
我认为我不需要.我不得不删除 jmemmac.c
因为我是在 windows 上编译的,但是它给出了更多的错误,所以我一直删除那些无用的文件,但现在我不知道该怎么办了.
I noticed there was some .c files which i had to delete, but i dont know if i deleted the correct ones, there was at least these files jmemmac.c
and jmemdos.c
which i figured i dont need. I had to delete jmemmac.c
because i compile on windows, but it gave more errors so i kept deleting those useless files, but now i dont know what to do anymore.
以下是我在构建时遇到的所有错误:
Here are all the errors i got when building:
1>.\ansi2knr.c(273) : warning C4013: 'exit' undefined; assuming extern returning int
1>.\example.c(116) : warning C4013: 'exit' undefined; assuming extern returning int
1>.\example.c(379) : warning C4013: 'put_scanline_someplace' undefined; assuming extern returning int
1>ckconfig.obj : error LNK2005: _main already defined in wrjpgcom.obj
1>djpeg.obj : error LNK2005: _main already defined in wrjpgcom.obj
1>rdjpgcom.obj : error LNK2005: _main already defined in wrjpgcom.obj
1>jpegtran.obj : error LNK2005: _main already defined in wrjpgcom.obj
1>cjpeg.obj : error LNK2005: _main already defined in wrjpgcom.obj
1>ansi2knr.obj : error LNK2005: _main already defined in wrjpgcom.obj
1>jmemmgr.obj : error LNK2001: unresolved external symbol _jpeg_open_backing_store
1>jmemmgr.obj : error LNK2001: unresolved external symbol _jpeg_get_small
1>jmemmgr.obj : error LNK2001: unresolved external symbol _jpeg_mem_term
1>jmemmgr.obj : error LNK2001: unresolved external symbol _jpeg_free_large
1>jmemmgr.obj : error LNK2001: unresolved external symbol _jpeg_get_large
1>jmemmgr.obj : error LNK2001: unresolved external symbol _jpeg_mem_available
1>jmemmgr.obj : error LNK2001: unresolved external symbol _jpeg_free_small
1>jmemmgr.obj : error LNK2001: unresolved external symbol _jpeg_mem_init
1>example.obj : error LNK2001: unresolved external symbol _image_height
1>example.obj : error LNK2001: unresolved external symbol _image_buffer
1>example.obj : error LNK2001: unresolved external symbol _put_scanline_someplace
1>example.obj : error LNK2001: unresolved external symbol _image_width
推荐答案
好的,如果您正在编译 DLL,您通常不需要任何main"函数.我假设引用名为main"或_main"的函数的源文件是如何使用库的示例,因此应该保存以摆脱它们.
Ok, if you're compiling a DLL, you generally don't want any "main" functions. I assume the source files referencing a a function called "main" or "_main" are examples of how to use the library, so it should be save to get rid of those.
在 jmemmac.c 中有一个名为jpeg_open_backing_store"的函数,它是 jmemmgr 抱怨的未解析外部符号之一.该函数似乎具有平台相关的调用,例如 Mac 的FindFolder"函数.
In jmemmac.c, there is a function called "jpeg_open_backing_store", which is one of the unresolved external symbols jmemmgr is complaining about. The function appears to have platform-dependant calls, such as the "FindFolder" function for mac.
我唯一能想到的就是研究 jmemmac.c、jmemdos.c 和 jmemansi.c 并重写这些函数,以便它们可以在 windows 平台上运行.
The only thing I can think of to do is to study jmemmac.c, jmemdos.c and jmemansi.c and rewrite those functions so they will work on a windows platform.
哦,对于未定义的exit",包括stdlib.h",因为它定义了退出函数.
Oh, and as for "exit" being undefined, include "stdlib.h", as it defines the exit function.
这篇关于如何构建这个项目?(jpeg 库)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!