[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-xorriso] Link errors against libisoburn
From: |
Andrei Borzenkov |
Subject: |
Re: [Bug-xorriso] Link errors against libisoburn |
Date: |
Tue, 15 Mar 2016 19:47:15 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 |
15.03.2016 19:05, Thomas Schmitt пишет:
> Hi,
>
> i tried something similar (and learned that i have to include
> more type defining headers in libisoburn.h)
>
> -----------------------------------------------------------------
> #include <ctype.h>
> #include <sys/types.h>
> #include <unistd.h>
> #include <stdlib.h>
> #include <stdint.h>
>
>
> #include <libburn/libburn.h>
> #include <libisofs/libisofs.h>
> #include <libisoburn/libisoburn.h>
>
> int main(int argc, char **argv)
> {
> char msg[1024];
>
> return isoburn_initialize(msg, 0);
> }
> -----------------------------------------------------------------
>
> The problem seems to get introduced by
>
> g++ -c main.c
>
> because this works:
>
> gcc -c main.c
> g++ -o isoburntest main.o -lisofs -lburn -lisoburn
>
> whereas this does not
>
> g++ -c main.c
> cc -o isoburntest main.o -lisofs -lburn -lisoburn
>
> but rather reports
>
> main.c:(.text+0x28): undefined reference to `isoburn_initialize(char*, int)'
>
> It happens alike with
>
> g++ -o isoburntest main.c -lisofs -lburn -lisoburn
>
> Currently i am clueless what g++ might want as extra info so that
> it produces linkable main.o.
>
You need to mark isoburn_initialize for C linkage:
extern "C" {
int isoburn_initialize(char msg[1024], int flag);
}
Actually you probably need to wrap the whole include file into
#ifdef __cplusplus
extern "C" {
#endif
...
#ifdef __cplusplus
}
#endif