Re: [ILUG] Linker problems

From: Colin Nevin (colin.nevin at domain meritsolutions.ie)
Date: Wed 18 Sep 2002 - 17:45:02 IST


Carlos,

Assuming the linker is finding the library ok is the jpeg api in C ?

By default c++ compilers and g++ do name mangling when resolving the
references to link with the functions in a library, so if you put :-

#ifdef __cplusplus /* stop g++ mangling C Api function names */

extern "C" int jpeg_xxxxx()
extern "C" int jpeg_yyyyy()
...
...

#endif

around the function prototypes for the jpeg API it may resolve the
problem, if you got a .h file with the jpeg prototypes in there it
should include that but you can put it in there manually.
 
C.

On Wed, 2002-09-18 at 15:55, Carlos Luna wrote:
> Apologies for the seemingly short comment... didn't mean it that way.
>
> Here's the command used:
> g++ -o jpeg_demo jpeg_demo.cpp -ljpeg
>
> And here's the response:
> /tmp/cc1Xp9yf.o: In function 'readJpeg(char*,Image*)':
> /tmp/cc1Xp9yf.o(.text+0x15): undefined reference to
> 'jpeg_std_error(jpeg_error_mgr*)'
> /tmp/cc1Xp9yf.o(.text+0x36): undefined reference to
> 'jpeg_CreateDecompress(jpeg_decompress_struct*,int,unsigned int)'
> ...etc. The rest are much the same listing the other jpeg library functions
> I used.
>
> Thanks again.
> Carlos
>
> --
> Irish Linux Users' Group: ilug at domain linux.ie
> http://www.linux.ie/mailman/listinfo/ilug for (un)subscription information.
> List maintainer: listmaster at domain linux.ie
>

-- 
Colin Nevin,
Software Engineer,
Merit Solutions Ltd. (Dublin),
5 Goatstown Cross,
Dublin 14.
Ph/Fax +353 (0)1 2885193


This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:18:56 GMT