Linux jrtplib编译错误解决

本文记录了一次编译过程中遇到的未定义引用错误,详细列出了与JRTP库相关的多个函数和类实例化的链接错误,并给出了简单的解决方案:通过添加-ljrtp参数到g++命令来正确链接JRTP静态库。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 /tmp/ccT7Z5Vh.o: In function `checkerror(int)':
example1.cpp:(.text+0x91): undefined reference to `jrtplib::RTPGetErrorString(int)'
/tmp/ccT7Z5Vh.o: In function `main':
example1.cpp:(.text+0x137): undefined reference to `jrtplib::RTPSession::RTPSession(jrtplib::RTPRandom*, jrtplib::RTPMemoryManager*)'
example1.cpp:(.text+0x2bc): undefined reference to `jrtplib::RTPSessionParams::RTPSessionParams()'
example1.cpp:(.text+0x327): undefined reference to `jrtplib::RTPSession::Create(jrtplib::RTPSessionParams const&, jrtplib::RTPTransmissionParams const*, jrtplib::RTPTransmitter::TransmissionProtocol)'
example1.cpp:(.text+0x367): undefined reference to `jrtplib::RTPSession::AddDestination(jrtplib::RTPAddress const&)'
example1.cpp:(.text+0x3d1): undefined reference to `jrtplib::RTPSession::SendPacket(void const*, unsigned int, unsigned char, bool, unsigned int)'
example1.cpp:(.text+0x3ed): undefined reference to `jrtplib::RTPSession::BeginDataAccess()'
example1.cpp:(.text+0x3fb): undefined reference to `jrtplib::RTPSession::GotoFirstSourceWithData()'
example1.cpp:(.text+0x422): undefined reference to `jrtplib::RTPSession::DeletePacket(jrtplib::RTPPacket*)'
example1.cpp:(.text+0x430): undefined reference to `jrtplib::RTPSession::GetNextPacket()'
example1.cpp:(.text+0x44c): undefined reference to `jrtplib::RTPSession::GotoNextSourceWithData()'
example1.cpp:(.text+0x45e): undefined reference to `jrtplib::RTPSession::EndDataAccess()'
example1.cpp:(.text+0x4d4): undefined reference to `jrtplib::RTPSession::BYEDestroy(jrtplib::RTPTime const&, void const*, unsigned int)'
example1.cpp:(.text+0x59e): undefined reference to `jrtplib::RTPSession::~RTPSession()'
example1.cpp:(.text+0x5c6): undefined reference to `jrtplib::RTPSession::~RTPSession()'
/tmp/ccT7Z5Vh.o: In function `jrtplib::RTPIPv4Address::RTPIPv4Address(unsigned int, unsigned short)':
example1.cpp:(.text._ZN7jrtplib14RTPIPv4AddressC1Ejt[jrtplib::RTPIPv4Address::RTPIPv4Address(unsigned int, unsigned short)]+0x21): undefined reference to `vtable for jrtplib::RTPIPv4Address'
/tmp/ccT7Z5Vh.o: In function `jrtplib::RTPIPv4Address::~RTPIPv4Address()':
example1.cpp:(.text._ZN7jrtplib14RTPIPv4AddressD1Ev[jrtplib::RTPIPv4Address::~RTPIPv4Address()]+0x7): undefined reference to `vtable for jrtplib::RTPIPv4Address'
collect2: ld 返回 1


解决:没有找到静态链接库:编译时加上参数 -l jrtp 就OK了

  eg:  g++ example1.cpp -l jrtp -o example_pc 


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值