一言
のんびり,のんびり,ね.
EclipseでQualnetを使えるようにする
How to debug QualNet? using Eclipse CDT in Ubuntu Linux
Hello all,
I have searched the forums for some linux equivalent to compiling QualNet? under Visual Studio in Windows and have found no such information. Therefore I have come up with a small tutorial for those interested in using Eclipse IDE forC/C++ Developers as a visual environment for compiling QualNet? under Linux.
This has been tested under Ubuntu 8.04 with gcc version 4.2.4 and Eclipse platform version 3.6.0:
1. Compiling QualNet? in Eclipse
This assumes g++, gcc and eclipse properly installed and working. For installing Eclipse visit
http://www.eclipse.org.
1.1. Configuring Eclipse CDT
1. Using a text editor, create a file named Makefile in the $QUALNET_HOME directory. This file contains commands to redirect to a makefile in $QUALNET_HOME/main. (The indentations in the following file are tabs, not spaces.)
• Makefile should contain the following lines:
all: cd main; make -f Makefile-linux-glibc-glibcver-gcc-gccver
clean: cd main; make clean -f Makefile-linux-glibc-glibcver-gcc-gccver
where glibcver and gccver are the glibc and gcc version of your Linux distribution (see Section 2.3 of the QualNet? 5.0.2 Programmers’ Guide about Compiling QualNet? in Linux)
2. Open Eclipse
3. If prompt pops up asking you to choose workspace you can choose whatever workspace desired
4. Select File > New > Project > C/C++ > C++ Project. Then click Next
5. Uncheck Use Default Location then enter the following information: • Project Name: qualnet • Location: /home/username/snt/qualnet/5.0 (if installed elsewhere then change accordingly) • Project Type: Makefile Project > Empty Project • Toolchains: Linux GCC
6. Click Finish
1.2. Compiling QualNet? from Eclipse CDT
Once Eclipse CDT has been configured, it can be used as follows:
• To build QualNet?: select Project > Build Project • To clean the object files and rebuild QualNet?: select Project > Clean..., then select Clean projects selected below and check qualnet. Then check Start a build immediately and select Build only the selected projects. Finaly press OK • To clean the object files: select Project > Clean..., then select Clean projects selected below and check qualnet. Make sure Start a build immediately is unchecked and press OK
2. Debugging QualNet? with Eclipse
The CDT's extensibility allows you to connect its graphical debugging capabilities to your custom debugger, in this case gdb. To run the debugger on UNIX systems, QualNet? must be compiled with the debug option. See Section 2.7.2 of the QualNet? 5.0.2 Programmers’ Guide about debugging QualNet? in Linux
1. Go to Run > Debug Configurations
2. Right click on C/C++ Applications, and then choose New. This should create a new debug configuration with the name qualnet Default. 3. In the Main tab type the following settings: • C/C++ Application: bin/qualnet • Project: qualnet
4. In the Arguments tab type the following:
• Program arguments: the name of the .config file of the scenario to debug • Working directory: the name of the directory the scenario to debug is located in (uncheck Use default) 5. In the Debugger tab the following should already exist:
• GDB debugger: gdb • GDB command file: .gdbinit
Make sure Stop at startup at main is unchecked
6. Now you can set the breakpoints as desired and debug by choosing Debug from the Run menu
Attached you will find a pdf file with the tutorial which includes pictures.
I am sure this can work on other distributions too. Hope this helps anyone interested.
+追記:デバッグの設定をするときにEnviromentにQUALNET_HOMEを追加しないといけません.お忘れなく
+追記:うろ覚えですが,makeファイルの最適化オプションに注意.最適化をなしにしないとデバッグ時に見れないパラメータがある.
最終更新:2012年06月13日 23:48