将NS2嵌入到Eclipse中进行开发运行

NS2嵌入到Eclipse中进行开发运行

2013-4-18

一. 准备工作

l 安装NS2 (通进源码包进行编译安装)

l 安装Eclipse[1],我使用的是ubuntu系统。

l 安装GCC工具链,命令如下:

sudo apt-get install build-essential

二. UbuntuLinux)使用Eclipse搭建C/C++编译环境 

l To install C/C++ development tools (CDT),from Eclipse select Help->Install New Software ( Alternate method : download from a browser.

l Click Available Software Sites and choose one site , then copy it. Click ok.

l Past the web site you have selected to the [work with:]

l Select Programming Languages 

l Select C/C++ Development Tools &C/C++ Development Tools SDk

l Click Next and go on, untile you have finished successfully.

l 部分截图

一. 将NS2嵌入到Eclipse

l Open Eclipse

l New workspace

l Choose File -> New -> Project -> C++ Project

l Select Project Type as Makefile Project -> Empty C++ Project.Toolchains: Linux GCC

l Enter Project Name as ns2

l Select “Next” and “Finish.

l Right click ns2(the project name ) 

Select  C/C++ General ->Paths and Symbols-> Source Location->add Folder

l Select /home/username/ns2安装文件夹

l From the workspace, Selecting the NS-2 Project and choosing Project -> Build All should not give Error.

l  Running the project must open the console with the NS-2 prompt, %

二. 配置调试功能

方案一:

l  cd ..../ns-allinone-2.35/ns-2.35

l sudo ./configure -enable-debug

l sudo make

方案二:

l Open .../ns-allinone-2.35/ns-2.35/Makefile.in

l  Add these lines anywhere near the top of the file

CCOPT = -g  # Hinzufügen der "-g"-Option 

DEFINE = -DNDEBUG  # Löschen des NoDebug-Flags 

DEFINE = -DDEBUG  # Hinzufügen des Debug-Flags 

l run sudo ./configure

l Run ”./make clean”     ”./make depend”     ”./make” 

三. 设置eclipse中的debug

l Select Run -> Debug Configurations

l Choose C/C++ Application. Type in any name. 

l Under the Main tab, Choose the following:Project as ns-2

l C/C++ Application as bin/ns

l Under the Debugger tab, choose GDB Debugger. Uncheck the “Stop on startup at” option

l  Apply and Debug

四. 增加tcl运行功能

l NS有两种运行方式,

运行方式一:在终端中直接输入ns,会出现%提示符,在该提示符下可输入NS命令。上一步所示属于这种方式。

运行方式二:增加tcl运行功能这需要设 置。进入Properties for New configuration框,点击Arguments, 在其中的program arguments框中输入example1.tcl并保存即可。

注意,此时,example1.tcl应处于项目目录下,否则输入tcl 文件的完整目录。例如:

/home/ubuntu/ns-allinone-2.35/ns-2.35/tcl/ex/example.tcl

五. 参考文献

1. Install Eclipse & UbuntuLinux)使用Eclipse搭建C/C++编译环境 http://www.lvr.com/eclipse2.htm

2. 将NS2嵌入到Eclipse中 http://www.baisi.net/thread-3039994-1-2.html

3. NS2 for Eclipse http://blog.csdn.net/king_far/article/details/5935409

4. Ubuntu 12.04 使用Eclipse搭建C/C++编译环境 http://blog.sina.com.cn/s/blog_93dc666c01019xft.html

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值