1

I'm trying to use jpeglib to write a jpeg file to my own, without use the pre-build functions like jpeg_compress etc etc, but writing headers and tables individually... And here there are a lots of problem...

I'm using Windows and Visual Studio, so I tried to install the .exe file from gnuwin site and include in my code the 4 header files of the "include" folder, but when I try to call some functions like write_file_header, jpeg_stdio_dest etc etc, it says that there is a missing link, so I must include every .c file where those function are implemented...

I tried to include the src files too, but same result... every example I find includes only the header jpeglib.h and nothing else, but in this way I cannot use the functions I need, so my question is, how can I use those libraries properly? thank you

Edit: the error message is error C3861: identifier not found... simply, when i try to call some function situated in some .c file of the libjpeg, the compiler cannot found where those function are...

Edit n.2:here the start of function:

#include "jpeglib.h"
#include "jerror.h"
#include "Common.h"

void jpeg(unsigned int *Src, int srclen, unsigned int *cod, unsigned int *length){

struct jpeg_compress_struct cinfo;

write_file_header(&cinfo); <- here is the problem... how can i access that function?

1 Answers1

0

You should not include the .c files directly, you have to tell your compiler to link against the library like in this tutorial.

The jpeg library has to be built separately.

Constantinius
  • 34,183
  • 8
  • 77
  • 85
  • i did it, but it be useless, no chancge to the output messages... if it was so simple, i wouldn't post here :) –  Jun 28 '12 at 08:13
  • Maybe you should update your question with the exact error messages your compiler/linker produces. – Constantinius Jun 28 '12 at 09:43
  • jpeg library might be built separately, but this is not necessary. One can include the files into project as well and this is in fact a simpler thing to do. – Roman R. Jun 28 '12 at 10:22
  • well, but it doesn't work, nor if i built it semparately and nor if i use src file as they are, this is the problem –  Jun 28 '12 at 10:46
  • C3861 means that a symbol is not found during compilation. Does the compiler find the correct header files of the library? Do you make the correct `#include "..."` statements? You obviously need to give us some more information. – Constantinius Jun 28 '12 at 13:06
  • of course i include the proper header, but the issues is that function that i want to call isn't in that file, but in another .c file... it was logically to think that if i had included the jpeglib.h header I would have had access to all of the function, but is not so... –  Jun 28 '12 at 13:22
  • Okay, to clarify this: If the function is in no public header, the designer of the library simply does not *want* you to use that function (for whatever reason). – Constantinius Jun 28 '12 at 13:25
  • well, if it is real and i'm not suppose to call directly function like write_file_header, how can i write a jpeg header? someone suggest me to use libjpeg and function write_file_header to start explore the possibilities, but now? –  Jun 28 '12 at 13:47
  • After looking up the `write_file_header` function, I believe it really is not for a direct use. Maybe you have to look for another way to achieve what you want to do. – Constantinius Jun 28 '12 at 14:35
  • i was afraid of this... this is a very very bad conclusion, so do you have any suggestion? –  Jun 28 '12 at 14:39
  • Haha yeah, everyone knows chinese here i guess. – Lukas Feb 20 '14 at 09:11
  • Hm, one and a half year ago, the link actually pointed to a page containing *english* documentation. All the documentation stuff can also be found in the official CVS here: http://libjpeg.cvs.sourceforge.net/viewvc/libjpeg/libjpeg/ – Constantinius Feb 20 '14 at 09:37