2015-11-03 41 views
0

输出:未定义参照 'owr_init'(连接器错误)使所有的

make all 
Building file: ../webrtc.c 
Invoking: Cross GCC Compiler 
gcc -std=c99 -I/opt/openwebrtc-0.3/include/ -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -O0 -g3 -Wall -c -fmessage-length=0 -ansi -MMD -MP -MF"webrtc.d" -MT"webrtc.o" -o "webrtc.o" "../webrtc.c" 
Finished building: ../webrtc.c 

Building target: WebRTC 
Invoking: Cross GCC Linker 
gcc ./webrtc.o -lglib-2.0 -lsctp -o "WebRTC" -L/opt/openwebrtc-0.3/lib -L/usr/lib/x86_64-linux-gnu/glib-2.0/include -L/usr/include/glib-2.0 
./webrtc.o: In function `startServer': 
/home/sn/workspace/cpp/praktikum/WebRTC/Debug/../webrtc.c:17: undefined reference to `owr_init' 
/home/sn/workspace/cpp/praktikum/WebRTC/Debug/../webrtc.c:18: undefined reference to `owr_run_in_background' 
collect2: error: ld returned 1 exit status 
makefile:32: recipe for target 'WebRTC' failed 
make: *** [WebRTC] Error 1 

webrtc.c:

#include "webrtc.h" 
int main(void) 
{ 
    /*startClient();*/ 
    startServer(); 
    return EXIT_SUCCESS; 
} 
void startServer(void) 
{ 
    printf("Initializing OpenWebRTC"); 
    owr_init(NULL); 
    owr_run_in_background(); 
} 

webrtc.h:

#include <stdio.h> 
#include <stdlib.h> 
#include <string.h> 
#include <strings.h> 
#include <errno.h> 
#include <ctype.h> 
#include <sys/socket.h> 
#include <sys/types.h> 
#include <arpa/inet.h> 
#include <netinet/in.h> 
#include <netinet/sctp.h> 
#include <arpa/inet.h> 
#include <unistd.h> 
#include <pthread.h> 

#include <owr/owr.h> 
#include <owr/owr_data_channel.h> 
#include <owr/owr_crypto_utils.h> 
#include <owr/owr_types.h> 
/* Defines:*/ 
#define MAX_BUFFER 1024 

#define SERVER_PORT_NUMBER 65300 
#define SERVER_BIND_ADDR "127.0.0.1" 

/* Prototypes: */ 
void startServer(void); 

文件的输出:

libopenwebrtc.so.4201.0.0: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=3a9726e870736687b14c1dca326bda336fb2d088, stripped 

我已经构建了OpenWebRTC,正如位于Debian 8上的wiki所述,并安装了生成的.deb文件。在Eclipse中,我包含了头文件(/opt/openwebrtc-0.3/include)和libs(/opt/openwebrtc-0.3/lib),它仍然不起作用。我还上传生成的deb文件到我的apt repository

的sources.list:

deb http://openwebrtc.niehus.eu/apt/debian/ jessie main 
+0

你能找到文件'libopenwebrtc.la'吗? – mic4ael

+0

是,/opt/openwebrtc-0.3/lib/libopenwebrtc.la –

回答

1

试图改变

gcc ./webrtc.o -lglib-2.0 -lsctp -o "WebRTC" -L/opt/openwebrtc-0.3/lib -L/usr/lib/x86_64-linux-gnu/glib-2.0/include -L/usr/include/glib-2.0 

gcc ./webrtc.o -lglib-2.0 -lsctp -lopenwebrtc -o "WebRTC" -L/opt/openwebrtc-0.3/lib -L/usr/lib/x86_64-linux-gnu/glib-2.0/include -L/usr/include/glib-2.0 

的问题可能是你没有链接必要的库。

相关问题