vs2005中的error LNK2019
描述:同样的代码在vc++6.0中是可以的,但是我现在移到vs2005就出现了下面的错误(出错的地方在代码里标出来了)。
我用的是jthread.lib和jrtplib.lib这两个库,也在vs2005重新编译了。
- C/C++ code
#pragma once//RTP支持#include "jrtp/RTPSession.h"#include "jrtp/RTPIPv4Address.h"#include "jrtp/RTPSessionParams.h"#include "jrtp/RTPUDPv4Transmitter.h"#include "jrtp/rtpsession.h"#include "jrtp/RTPPacket.h"#include "RTPAppSession.h"const int PORT_BASE = 14506;const long MAX_PACKET_SIZE = ((1024 * 64) - 1);struct DataSession{ RTPSession rtpSend; RTPAppSession rtpReceive;};class CRtpInit{public: void Init(CDialog *dlg,uint16_t LocalAudioPort,uint16_t RomateAudioPort);public: //RTP传输变量 DataSession m_sessData; unsigned long intIP; RTPIPv4Address *rtpAddr;};- C/C++ code
#include "StdAfx.h"#include "RtpInit.h"#include "jrtp/rtpsession.h"void CRtpInit::Init(CDialog *dlg,uint16_t LocalAudioPort,uint16_t RomateAudioPort){ RTPSessionParams sessParams; RTPUDPv4TransmissionParams transParams; WORD wVersionRequested; WSADATA wsaData; wVersionRequested=MAKEWORD(2,2); if(WSAStartup(wVersionRequested,&wsaData)!=0) { return; } //建立RTP的数据发送 sessParams.SetOwnTimestampUnit(1.0 / 30.0); //30 video frames per second sessParams.SetUsePollThread(1); //background thread to call virtual callbacks - set by default, but just to be sure sessParams.SetMaximumPacketSize(MAX_PACKET_SIZE); transParams.SetPortbase(PORT_BASE); m_sessData.rtpSend.Create(sessParams, &transParams);//这句出错。在vc6.0里是正确的。}错误信息:
1>jrtplib.lib(rtprandom.obj) : error LNK2019: unresolved external symbol __imp__srand referenced in function "public: __thiscall RTPRandom::RTPRandom(void)" (??0RTPRandom@@QAE@XZ)
1>jrtplib.lib(rtprandom.obj) : error LNK2019: unresolved external symbol __imp__clock referenced in function "public: __thiscall RTPRandom::RTPRandom(void)" (??0RTPRandom@@QAE@XZ)
1>jrtplib.lib(rtprandom.obj) : error LNK2019: unresolved external symbol __imp___getpid referenced in function "public: __thiscall RTPRandom::RTPRandom(void)" (??0RTPRandom@@QAE@XZ)
1>jrtplib.lib(rtprandom.obj) : error LNK2019: unresolved external symbol __imp___time64 referenced in function _time
1>jrtplib.lib(rtprandom.obj) : error LNK2019: unresolved external symbol __imp__rand referenced in function "unsigned char __cdecl GetRandom8_Default(void)" (?GetRandom8_Default@@YAEXZ)
1>jthread.lib(jthread.obj) : error LNK2019: unresolved external symbol __imp___beginthreadex referenced in function "public: int __thiscall JThread::Start(void)" (?Start@JThread@@QAEHXZ)
1>.\bin\AudioChat.exe : fatal error LNK1120: 6 unresolved externals
1>Build log was saved at "file://e:\Projects\showgame3\TestProjects\AudioChat\AudioChat\AudioChat\Debug\BuildLog.htm"
1>AudioChat - 7 error(s)
[解决办法]
_imp__rand referenced in function "unsigned char __cdecl GetRandom8_Default(void)" 构造函数没定义啊。
ymbol __imp___beginthreadex referenced in function "public: int __thiscall JThread::Start(void)" 加了你那句话估计调用了这些函数,
然后,这些函数,没有找到。
可能你的工程里面依赖项没有设置好吧?
[解决办法]
不会
估计大侠 不会犯该连接的库没有链的错误
帮顶
[解决办法]
你在build jthread.lib和jrtplib.lib这两个库的时候不要链接 msvcrt.lib