安装之前改一下nam1.11下的agent.h文件73行 Null改为0
第一个错误
:
xxx configuration:
Syntax error: Unterminated quoted string
,
tcl,tk,otcl安装时都会遇到这个问题(原因是gcc对语法要求更加严格)。
解决办法:
分别进入以下3个文件夹:
*/ns-allinone-2.29/tcl8.4.11/unix/
*/ns-allinone-2.29/tcl8.4.11/tk8.4.11/unix/
*/ns-allinone-2.29/otcl-1.11/
gedit进入configure文件 搜索 ”
relid
” 找到全部 ”
.relid
‘
`
” 改为 ”
.relid`
”
第二个错误:
make: *** [tk3d.o] 错误 1
解决办法:
安装libx11-dev可以解决问题(可使用新立德)
第三个错误:
checking for X… configure: error: Can’t find X includes
解决办法:
sudo apt-get install xorg-dev
第四个错误:
make:***[libotcl.so] 错误1
otcl- make failed! Exiting…
解决办法:
在gcc 4.0版本以前是用ld -share来生成共享库,但是到了4.0以及以上版本,这个命令改为了gcc -share。好了,问题找到了,就知道该怎么处理了。
进入otcl-1.13目录,找到configure.in.因为我用的是Ubuntu,所以只改Linux平台部分就得,
将77行,
SHLIB_LD=”ld -shared”
改为
SHLIB_LD=”gcc -shared”
同时修改configure 第5518行
SHLIB_LD=”ld -shared”
改为
SHLIB_LD=”gcc -shared”
第五个错误
:
make: g++:命令未找到
make: *** [tcl2c++] 错误 127
tclcl- make failed! Exiting …
解决办法:
sudo apt-get install g++
第六个错误:
Tcl.cc:605: warning: deprecated conversion from string constant to ‘char*’
make: *** [Tcl.o] 错误 1
tclcl-1.18 make failed! Exiting …
由于gcc版本过高引起的编译问题 gcc-4.4 –> gcc-4.3
1. sudo apt-get install gcc-4.3
但是这时系统默认的GCC还是4.4版的,可以通过gcc -v查看版本号
设置GCC4.3和GCC4.4的可选项,在终端输入以下命令
1. sudo update-alternatives –install /usr/bin/gcc gcc /usr/bin/gcc-4.4 40
2. sudo update-alternatives –install /usr/bin/gcc gcc /usr/bin/gcc-4.3 30
现在设置GCC的默认版本,输入下面命令:
sudoupdate-alternatives –config gcc
我得到的结果:
There are 2choices for the alternative gcc (providing /usr/bin/gcc).
Selection Path Priority Status
————————————————————
* 0 /usr/bin/gcc-4.4 40 auto mode
1 /usr/bin/gcc-4.3 30 manual mode
2 /usr/bin/gcc-4.4 40 manual mode
然后输入“1”,再查看一下gcc的版本,已经变成4.3的了~~~~
同样对于g++也可以使用同样的方法从4.4高版本切换到4.3低版本。。。
由于我按照上述步骤装了gcc-4.3的不行,又装了gcc-4.1的仍然不行,于是就干脆进到tclcl-1.18文件夹下查找原因,最终发现的确因为是编译器版本过高引起的,但是是由于g++版本过高,而不是gcc,解决步骤如下:
1. sudo apt-get install g++-4.1
2. ls /usr/bin/g++*
得到结果:
/usr/bin/g++ /usr/bin/g++-4.1 /usr/bin/g++-4.4
3. update-alternatives –install /usr/bin/g++ g++ /usr/bin/g++-4.4 40
4. update-alternatives –install /usr/bin/g++ g++ /usr/bin/g++-4.1 30
5. sudo update-alternatives –config g++
得到结果:
Selection Path Priority Status
————————————————————
* 0 /usr/bin/g++-4.4 40 auto mode
1 /usr/bin/g++-4.1 30 manual mode
2 /usr/bin/g++-4.4 40 manual mode
选择1即可
第7个错误:
./sctp/sctp.h:630: error: extra qualification ‘SctpAgent::’ on member ‘DumpSendBuffer’
make: *** [trace/trace.o] 错误 1
Ns make failed!
解决办法:
去掉
/sctp/sctp.h下的 ‘SctpAgent::’
第8个错误:
make: *** [src_rtg/sragent.o] 错误 1
Ns make failed!
$gedit /usr/NS2/ns-allinone-2.27/ns-2.27/mobile/god.h
inline void vector::operator=(const vector a)
inline void vector::operator+=(const vector a)
inline int vector::operator==(const vector a)
inline int vector::operator!=(const vector a)
改为:
inline void operator=(const vector a)
inline void operator+=(const vector a)
inline int operator==(const vector a)
inline int operator!=(const vector a)
需要修改的文件:
问题:
./sctp/sctp.h:632: 错误:有多余的限定‘SctpAgent::’在成员‘DumpSendBuffer’上
trace/trace.cc:185: 警告:不建议使用从字符串常量到‘char*’的转换
trace/trace.cc:185: 警告:不建议使用从字符串常量到‘char*’的转换
trace/trace.cc:185: 警告:不建议使用从字符串常量到‘char*’的转换
trace/trace.cc:185: 警告:不建议使用从字符串常量到‘char*’的转换
trace/trace.cc:185: 警告:不建议使用从字符串常量到‘char*’的转换
make: *** [trace/trace.o] 错误 1
Ns make failed!
$gedit /usr/NS2/ns-allinone-2.27/ns-2.27/sctp/sctp.h
void SctpAgent::DumpSendBuffer();
改为:
void DumpSendBuffer();
./mobile/god.h: At global scope:
./mobile/god.h:88: 错误:有多余的限定‘vector::’在成员‘operator=’上
./mobile/god.h:93: 错误:有多余的限定‘vector::’在成员‘operator+=’上
./mobile/god.h:98: 错误:有多余的限定‘vector::’在成员‘operator==’上
./mobile/god.h:101: 错误:有多余的限定‘vector::’在成员‘operator!=’上
make: *** [src_rtg/sragent.o] 错误 1
Ns make failed!
$gedit /usr/NS2/ns-allinone-2.27/ns-2.27/mobile/god.h
inline void vector::operator=(const vector a)
inline void vector::operator+=(const vector a)
inline int vector::operator==(const vector a)
inline int vector::operator!=(const vector a)
改为:
inline void operator=(const vector a)
inline void operator+=(const vector a)
inline int operator==(const vector a)
inline int operator!=(const vector a)
queue/cbq.cc:112: 错误:ISO C++ 不允许声明无类型的‘CBQueue’
queue/cbq.cc:112: 错误:expected ‘;’ before ‘*’ token
queue/cbq.cc: In member function ‘virtual int CBQueue::insert_class(CBQClass*)’:
queue/cbq.cc:488: 错误:‘class CBQClass’没有名为‘cbq_’的成员
queue/cbq.cc: In constructor ‘CBQClass::CBQClass()’:
queue/cbq.cc:805: 错误:类‘CBQClass’没有名为‘cbq_’的字段
queue/cbq.cc: In member function ‘virtual void CBQClass::recv(Packet*, Handler*)’:
queue/cbq.cc:850: 错误:‘cbq_’在此作用域中尚未声明
queue/cbq.cc:856: 错误:‘cbq_’在此作用域中尚未声明
queue/cbq.cc: In member function ‘void CBQClass::update(Packet*, double)’:
queue/cbq.cc:873: 错误:‘cbq_’在此作用域中尚未声明
queue/cbq.cc: In member function ‘int CBQClass::desc_with_demand()’:
queue/cbq.cc:928: 错误:‘cbq_’在此作用域中尚未声明
queue/cbq.cc: In member function ‘void CBQClass::newallot(double)’:
queue/cbq.cc:975: 错误:‘cbq_’在此作用域中尚未声明
queue/cbq.cc: In member function ‘virtual int CBQClass::command(int, const char* const*)’:
queue/cbq.cc:1002: 错误:‘cbq_’在此作用域中尚未声明
make: *** [queue/cbq.o] 错误 1
Ns make failed!
$gedit /usr/NS2/ns-allinone-2.27/ns-2.27/queue/cbq.cc
#define POWEROFTWO 16
+class CBQueue;
class CBQClass : public Connector {
./tora/tora_neighbor.h:72: 错误:ISO C++ 不允许声明无类型的‘toraAgent’
./tora/tora_neighbor.h:72: 错误:expected ‘;’ before ‘*’ token
tora/tora.cc: In member function ‘void toraAgent::rt_resolve(Packet*)’:
tora/tora.cc:238: 警告:不建议使用从字符串常量到‘char*’的转换
tora/tora.cc: In member function ‘void toraAgent::recvUPD(Packet*)’:
tora/tora.cc:462: 警告:不建议使用从字符串常量到‘char*’的转换
tora/tora.cc: In member function ‘void toraAgent::recvCLR(Packet*)’:
tora/tora.cc:648: 警告:不建议使用从字符串常量到‘char*’的转换
make: *** [tora/tora.o] 错误 1
Ns make failed!
$gedit /usr/NS2/ns-allinone-2.27/ns-2.27/tora/tora_neighbor.h
#define __tora_neighbor_h__
+class toraAgent;
enum LinkStatus {
dsr/dsragent.cc:787: 错误:‘XmitFlowFailureCallback’在此作用域中尚未声明
dsr/dsragent.cc:1344: 错误:‘XmitFailureCallback’在此作用域中尚未声明
make: *** [dsr/dsragent.o] 错误 1
Ns make failed!
$gedit /usr/NS2/ns-allinone-2.27/ns-2.27/dsr/dsragent.cc
+void XmitFlowFailureCallback(Packet *pkt, void *data);
+void XmitFailureCallback(Packet *pkt, void *data);
/*===========================================================================
SendBuf management and helpers
diffusion/diffusion.cc:404: 错误:‘XmitFailedCallback’在此作用域中尚未声明
make: *** [diffusion/diffusion.o] 错误 1
Ns make failed!
$gedit /usr/NS2/ns-allinone-2.27/ns-2.27/diffusion/diffusion.cc
#include “routing_table.h”
+void XmitFailedCallback(Packet *pkt, void *data);
char *MsgStr[]= {“”, “INTEREST”, “DATA”, “DATA_READY”, “DATA_REQUEST”,
diffusion/omni_mcast.cc:367: 错误:‘OmniMcastXmitFailedCallback’在此作用域中尚未声明
make: *** [diffusion/omni_mcast.o] 错误 1
Ns make failed!
$gedit /usr/NS2/ns-allinone-2.27/ns-2.27/diffusion/omni_mcast.cc
#include “god.h”
+void OmniMcastXmitFailedCallback(Packet *pkt, void *data);
static class OmniMcastClass : public TclClass {
tcp/tcp-sack-rh.cc:68: 错误:有多余的限定‘SackRHTcpAgent::’在成员‘newack’上
make: *** [tcp/tcp-sack-rh.o] 错误 1
Ns make failed!
$gedit /usr/NS2/ns-allinone-2.27/ns-2.27/tcp/tcp-sack-rh.cc
virtual void computefack();
//virtual void SackRHTcpAgent::newack(Packet* pkt);
+virtual void newack(Packet *pkt);
pgm/pgm-agent.cc:278: 错误:有多余的限定‘PgmAgent::’在成员‘trace_event’上
pgm/pgm-agent.cc: In member function ‘void PgmAgent::handle_rdata(Packet*)’:
pgm/pgm-agent.cc:578: 警告:不建议使用从字符串常量到‘char*’的转换
pgm/pgm-agent.cc: In member function ‘void PgmAgent::handle_nak(Packet*)’:
pgm/pgm-agent.cc:727: 警告:不建议使用从字符串常量到‘char*’的转换
pgm/pgm-agent.cc: In member function ‘void PgmAgent::handle_ncf(Packet*)’:
pgm/pgm-agent.cc:824: 警告:不建议使用从字符串常量到‘char*’的转换
make: *** [pgm/pgm-agent.o] 错误 1
Ns make failed!
$gedit /usr/NS2/ns-allinone-2.27/ns-2.27/pgm/pgm-agent.cc
void print_stats();
-//void PgmAgent::trace_event(char *evType, double evTime);
+void trace_event(char *evType, double evTime);
pgm/pgm-sender.cc:160: 错误:有多余的限定‘PgmSender::’在成员‘trace_event’上
pgm/pgm-sender.cc: In member function ‘virtual void PgmSender::handle_nak(Packet*)’:
pgm/pgm-sender.cc:472: 警告:不建议使用从字符串常量到‘char*’的转换
pgm/pgm-sender.cc: In member function ‘virtual void PgmSender::send_rdata(RdataItem*)’:
pgm/pgm-sender.cc:619: 警告:不建议使用从字符串常量到‘char*’的转换
make: *** [pgm/pgm-sender.o] 错误 1
Ns make failed!
$gedit /usr/NS2/ns-allinone-2.27/ns-2.27/pgm/pgm-sender.cc
-//void PgmSender::trace_event(char *evType, nsaddr_t daddr, double evTime);
+void trace_event(char *evType, nsaddr_t daddr, double evTime);
pgm/pgm-receiver.cc:157: 错误:有多余的限定‘PgmReceiver::’在成员‘trace_event’上
pgm/pgm-receiver.cc: In member function ‘void PgmReceiver::generate_Nak(int)’:
pgm/pgm-receiver.cc:589: 警告:不建议使用从字符串常量到‘char*’的转换
make: *** [pgm/pgm-receiver.o] 错误 1
Ns make failed!
$gedit /usr/NS2/ns-allinone-2.27/ns-2.27/pgm/pgm-receiver.cc
-void PgmReceiver::trace_event(char *evType, double evTime);
+void trace_event(char *evType, double evTime);
./diffusion3/filter_core/filter_core.hh:111: 错误:expected `)’ before ‘*’ token
make: *** [diffusion3/ns/diffagent.o] 错误 1
Ns make failed!
解决:
$gedit /usr/NS2/ns-allinone-2.27/ns-2.27/diffusion3/filter_core/filter_core.hh
class NeighborEntry;
+class DiffRoutingAgent;
typedef list<NeighborEntry *> NeighborList;
成功
转载于:https://www.cnblogs.com/liuxiaoke/p/3488616.html