1.C++技术方向
2.C程序调试工具gdb
安装gdb
比如有一个test.c程序要调试
我们先编译 gcc -o test test.c
再执行 ./test
再gdb调试 gdb test ,则发现问题 no debugging symbols found
退出gdb q
如何解决呢?
我们先编译 gcc -g -o test test.c
再执行 ./test
再gdb调试 gdb test ,则没有问题
下面是gdb常用命令
3.C 语言由源代码生成可执行程序的过程如下
C源程序--> 编译预处理--> 编译---> 优化程序---> 汇编程序---> 链接程序--->可执行文件
生成预处理文件,并查看
gcc -E -o test.E test.c
vi test.E
4.获取系统错误
用法:
#include <errorno.h>
#include <stdio.h>
#include<string.h>
printf("%d:%s\n", errorno, strerror(errorno));
5.make 和makefile文件
例如有如下makefile文件
makefile用法简单介绍:https://www.freecplus.net/b7a1c199959f4349b2a98874864a2000.html