Re: [gnet] gnet_pack linker error



On Sun, 2005-12-25 at 17:55 +0000, Jasminko Dedic wrote:

Hi Jasminko,

> I can't compile code using the gnet_pack or gnet_unpack functions. All other 
> work just fine and gnet-programs without gnet_pack or gnet_unpack compile 
> and run without any problems.
> 
> Error:
> /tmp/cc3qzwM8.o(.text+0x27a): In function `network::sendRequest()':
> : undefined reference to `gnet_pack(char const*, char*, int, ...)'
> collect2: ld returned 1 exit status
>  ...
> I'm running Debian Sarge
> libgnet-dev    2.0.7-1
> libgnet2.0-0   2.0.7-1

Indeed, the pack.h header file in 2.0.7 is missing the extern "C" bits
required to make c++ compilers happy. This has been fixed in CVS for a
while. I should be making a new release one of these days, I guess :)

As a work-around, you can do:

#ifdef __cplusplus
extern "C" {
#endif
#include <gnet.h>
#ifdef __cplusplus
}
#endif

If it's a c++ header/source file, you can leave out the #ifdef
__cplusplus of course ;)

Cheers
 -Tim





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]