0

Edit: im now using http://code.google.com/p/jpeg-compressor/ so i dont care about making this work anymore.

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.

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
Rookie
  • 4,064
  • 6
  • 54
  • 86
  • Did you follow the instructions for Visual Studio in the `install.txt` file? Which version of VS are you using? – Nicol Bolas Dec 04 '11 at 23:50
  • i did not... there were million files, i had no idea which i should read. anyways; im using http://code.google.com/p/jpeg-compressor/ now, so this problem is basically solved for me. – Rookie Dec 04 '11 at 23:55
  • You *always* start with `README` or some form of `README.*` file. That file would have pointed you in the direction of `install.txt`. You need to familiarize yourself with how libraries and such are commonly distributed. – Nicol Bolas Dec 05 '11 at 00:07
  • @nicol, thanks for the tip, ill try next time. – Rookie Dec 05 '11 at 00:59

1 Answers1

0

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.

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.

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.

Oh, and as for "exit" being undefined, include "stdlib.h", as it defines the exit function.

  • Thanks for help, managed to get exit() errors out. but still those some functions make errors, i cant even find function `put_scanline_someplace` anywhere in the sources! O_O this is a mess. i also removed main function but errors remain. Do you know any jpeg library that has only the jpeg saving function? and .lib/dll/h files for windows ? – Rookie Dec 04 '11 at 15:13
  • seems like this isnt issue anymore, i was told even better library: http://code.google.com/p/jpeg-compressor/ – Rookie Dec 04 '11 at 23:53