首先在Linux下写好一个.Cpp的文件。

 #include<stdio.h>
#include<stdlib.h>
using namespace std;
void show(int arr[], int size)
{
for (int i = ; i < size; ++i)
{
cout << arr[i] << " ";
}
cout << endl;
}
void reverse(int arr[], int size)
{
for (int i = ; i < size ; ++i)
{
int temp = arr[i];
arr[i] = arr[size - - i];
arr[size - - i] = temp;
cout << "第" << i + << "次输出" << endl;
for (int i = ; i < size; ++i)
{
cout << arr[i] << " ";
}
cout << endl;
cout << "------------------------------------" << endl; }
}
int main()
{
int arr[] = { };
for (int i = ; i < ; ++i)
arr[i] = (i + ) * ;
show(arr, );
reverse(arr, );
show(arr, );
system("pause");
return ;
}

在Linux下写完这个程序,我们需要在命令行对C++文件编译。

/*在Xshell中编译,在Linux环境下*/
g++ -o main main.cpp
/*可以使用更简单的,直接g++ main.cpp,这样生成的文件就是a.out*/

编译完成后,我们要启动GDB调试工具,命名为gdb + 要调试程序的程序名,在本例中使用命令为【gdb main】。

做完这一步我们就可以gdb的命令了...

最新文章

  1. .NET Core的日志[1]:采用统一的模式记录日志
  2. MyBatis通过JDBC生成的执行语句问题
  3. web前端之HTML的前世今生
  4. JDBC删除表数据
  5. SQL SERVER连接、合并查询
  6. du -sg 和df -g 所看的文件系统大小不一致
  7. Python eclipse开发环境搭建
  8. (转) ICCV 2015:21篇最火爆研究论文
  9. hdu 3585 二分+最大团
  10. TFS代码签入指导
  11. [React] React Fundamentals: Using Refs to Access Components
  12. Windows7 QT5.6.0(64位)使用mysql(64位)环境搭建详解
  13. Java GC机制和对象Finalize方法的一点总结
  14. Delphi对WM_NCHITTEST消息的处理
  15. 3DMax的OFusion插件使用问题
  16. windows rt 扫描二维码
  17. Python:当你遇到了the package “public”?
  18. 中国居民18位身份证号验证方法,Java算法实现
  19. bash 3
  20. JAVA记录-POST与GET方式区别

热门文章

  1. spark | 手把手教你用spark进行数据预处理
  2. HotSpot的类模型(2)
  3. 线程基础知识01-Thread类,Runnable接口
  4. finally 关键字
  5. C++输出三角图形
  6. 数据可视化之powerBI技巧(十六)采悟:PowerBI作图技巧:动态显示可视化标题
  7. How to install chinese input method
  8. [Cordova]Cordova6.x自定义插件之Andorid
  9. It is indirectly referenced from required .class files错误查找的解决办法如下
  10. Cyber Security - Palo Alto Firewall V-Wires