2.2在Ubuntu七inux中运行C/C+ ros@ros-pc:- rosaros-pc:-$qdb GNU gdb (Ubuntu 7.11.1-0ubuntul-16.5)7.11.1 Copyright (C)2016 Free Software Foundation,Inc. License GPLv3+:GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software:you are free to change and redistribute it. There is NO WARRANTY,to the extent permitted by law.Type "show copying" and "show warranty"for details. This GDB was configured as "x86 64-linux-gnu". Type "show configuration"for configuration details For bug reporting instructions,please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help,type "help". Type "apropos word"to search for commands related to "word". gdb) 图23测试gdb命令 8
2.2 在Ubuntu Linux中运行C/C++ 2.2.6 验证安装GDB 为了检查GDB是否正确安装在计算机中,可以使用 以下命令 gdb 为在终端中输入GDB,则会显示图2-3所示信息
2.2在Ubuntu Linux中运行C/C++ 2.2.6验证安装GDB 可以使用下面的命令查看GDB版本 gdb version 8
2.2 在Ubuntu Linux中运行C/C++ 2.2.6 验证安装GDB 可以使用下面的命令查看GDB版本 gdb version
2.2 在Jbuntu七inux中运行C/C++ 2.27编写第一个程序 用C++编写一个程序→编译并调试 终端文本编辑器来编写代码:gedit和nano 打开文本编辑器的方法,如图2-4。界面如图2-5 ⊙ untitled Documant t-gedit gedit A Applications Text Editor 图2.4在Ubuntu搜索中查找gedit文本编辑器 同ain Test¥Tab widthe= Ln.t.Col1¥ 图2-5gcdi文本编辑器
2.2 在Ubuntu Linux中运行C/C++ 2.2.7 编写第一个程序 用C++编写一个程序 → 编译并调试 终端文本编辑器来编写代码:gedit和nano 打开文本编辑器的方法,如图2-4。界面如图2-5
2.2在Ubuntu Linux中运行C/C+ 2.27编写第一个程序 编译一个C++程序,如图-6所示,编写完成后,保 存为hello world.cpp hello_world.cpp (-/Desktop)-gedit open m 5 #include <iostream> using namespace std; int main() cout<<"Hello Ubuntu Linux"<<endl; return 0; Tab width:8 Ln 12.Col2 图26第一个C++程序 8
2.2 在Ubuntu Linux中运行C/C++ 2.2.7 编写第一个程序 编译一个C++程序,如图2-6所示,编写完成后,保 存为hello_world.cpp
2.2 在Ubuntu七inux中运行C/C++ 2.2.8解释代码 hello_world.cpp代码将打印消息“Hello Ubuntu Linux''。 > #include<iostream>:C++头文件,包含输入/输出函 数 >Using namespace std:声明使用命名空间,其是C++ 中的一个特性,用于对一组实体进行分组。Iostream 库中使用std定义命名空间。 8
2.2 在Ubuntu Linux中运行C/C++ 2.2.8 解释代码 hello_world.cpp代码将打印消息“Hello Ubuntu Linux”。 ➢ #include <iostream>:C++头文件,包含输入/输出函 数 ➢ Using namespace std:声明使用命名空间,其是C++ 中的一个特性,用于对一组实体进行分组。Iostream 库中使用std定义命名空间