kurzen c-code "gegen" library linken - g722 und spandsp
-
Hi,
ich wollte folgenden c-code gerne compilieren: http://www.mail-archive.com/asterisk-dev@lists.digium.com/msg39438.html
Dabei handelt es sich um ein kleines Programm das wav files ohne Aualitaetsverlust in eine g722 datei umwandelt.
Dafuer muss das Programm, oder die Library spandsp dazu gelinkt werden. Diese habe ich auch hier am PC.
/usr/lib/libspandsp.so /usr/lib/libspandsp.so.1 /usr/lib/libspandsp.so.1.0.0
Nur komme ich mit dem gcc aufruf nicht zurecht. Die headerdateien haette ich auch alle da... auch den kompletten sourcecode, inklusive .c dateien etc
Aber wie muss ich denn gcc denn nun aufrufen um eine Ausfuehrbare Datei herraus zu bekommen??
greetz myname
-
gcc -lspandsp foo.c -o foo
wenn foo.c die C-Datei ist. Siehe http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Link-Options.html#Link-Options
-
Danke fuer die schnelle Antwort. Nun stosse ich aber noch auf folgenden Fehler:
(meine c-datei lautet myconvert.c)
(der gcc Aufruf lautet gcc -lspandsp g722.c myConvert.c -o myconvert)In file included from myConvert.c:24: g722.h: In function ‘SPAN_DECLARE’: g722.h:80: error: expected declaration specifiers before ‘g722_encode_init’ g722.h:85: error: expected declaration specifiers before ‘SPAN_DECLARE’ g722.h:90: error: expected declaration specifiers before ‘SPAN_DECLARE’ g722.h:98: error: expected declaration specifiers before ‘SPAN_DECLARE’ g722.h:106: error: expected declaration specifiers before ‘SPAN_DECLARE’ g722.h:111: error: expected declaration specifiers before ‘SPAN_DECLARE’ g722.h:116: error: expected declaration specifiers before ‘SPAN_DECLARE’ g722.h:124: error: expected declaration specifiers before ‘SPAN_DECLARE’ myConvert.c:30: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token myConvert.c:35: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token g722.h:80: error: parameter name omitted myConvert.c:80: error: expected ‘{’ at end of input In file included from g722.c:49: floating_fudge.h: In function ‘sinf’: floating_fudge.h:42: warning: incompatible implicit declaration of built-in function ‘sin’ floating_fudge.h: In function ‘cosf’: floating_fudge.h:49: warning: incompatible implicit declaration of built-in function ‘cos’ floating_fudge.h: In function ‘tanf’: floating_fudge.h:56: warning: incompatible implicit declaration of built-in function ‘tan’ floating_fudge.h: In function ‘asinf’: floating_fudge.h:63: warning: incompatible implicit declaration of built-in function ‘asin’ floating_fudge.h: In function ‘acosf’: floating_fudge.h:70: warning: incompatible implicit declaration of built-in function ‘acos’ floating_fudge.h: In function ‘atanf’: floating_fudge.h:77: warning: incompatible implicit declaration of built-in function ‘atan’ floating_fudge.h: In function ‘atan2f’: floating_fudge.h:85: warning: incompatible implicit declaration of built-in function ‘atan2’ floating_fudge.h: In function ‘ceilf’: floating_fudge.h:93: warning: incompatible implicit declaration of built-in function ‘ceil’ floating_fudge.h: In function ‘floorf’: floating_fudge.h:100: warning: incompatible implicit declaration of built-in function ‘floor’ floating_fudge.h: In function ‘powf’: floating_fudge.h:108: warning: incompatible implicit declaration of built-in function ‘pow’ floating_fudge.h: In function ‘log10f’: floating_fudge.h:129: warning: incompatible implicit declaration of built-in function ‘log10’ In file included from g722.c:53: spandsp/saturated.h: In function ‘fsaturatef’: spandsp/saturated.h:78: warning: incompatible implicit declaration of built-in function ‘lrintf’ spandsp/saturated.h: In function ‘fsaturate’: spandsp/saturated.h:88: warning: incompatible implicit declaration of built-in function ‘lrint’
der entsprechende Code aus der g722.h lautet:
/*! G.722 encode state */ typedef struct g722_encode_state_s g722_encode_state_t; /*! G.722 decode state */ typedef struct g722_decode_state_s g722_decode_state_t; #if defined(__cplusplus) extern "C" { #endif /*! Initialise an G.722 encode context. \param s The G.722 encode context. \param rate The required bit rate for the G.722 data. The valid rates are 64000, 56000 and 48000. \param options \return A pointer to the G.722 encode context, or NULL for error. */ SPAN_DECLARE(g722_encode_state_t *) g722_encode_init(g722_encode_state_t *s, int rate, int options);//<- das ist Zeile 80
greetz myname