- 论坛徽章:
- 0
|
1.打印机设备支持查看
ghostscript
gs --help
run fileneme
quit
2.扫描仪
SANE
家具自动控制设备
X10
3.Debugger
gdb Kdbg ddd xgdb
4.编程工具
indent 格式化源码
tags 生成的文件能增强编辑器浏览和和分析源码文件的能力
lclint快速源码分析
5.关于gcc
gcc test.c -o test
首先用cpp展开文件中的宏定义,预处理器
相当于gcc -E test.c -o test.cpp
编译
gcc -x cpp-output -c test.cpp -o test.o
链接
gcc test.o -o test
指定头文件
gcc myapp.c -I /home/include -o myapp
指定库
gcc myapp.c -L/home/lib -lnew -o myapp
静态链接
gcc cursesapp.c -lncurses -static -o curseasapp
-Wall给出所有可能的警告
-w 不给出任何警告
-fsyntax-only只进行语法检查
-O 123优化
-g 123加入调试信息 -ggdb 加入gdb需要的调试信息
-p -pg 将剖析信息加入到2进制文件 gprof
-Q 给出编译各种文件时使用的资源
gcc的扩展:
long long
__attribute__
case区间 case 0..10
__FUNCTION__
6.gdb 和 gprof的使用
7.C标准出错处理
assert()
__LINE__
__FILE__
stdlib.h:: void abort(); void exit(int);
int atexit(void (*fcn)(void));
//用于保证在程序结束前执行某个函数中的代码
void perror(const char*s);
char *strerror(int errnum);
errno.h int errno;
stdio.h void clearerr(FILE *stream);
int feof(FILE *stream);
int ferror(FILE *stream);
注意errno的使用技巧,大多数的math库函数出错时会把errno设置为非0,
所以在使用math库函数之后可以:
errno = 0;
int d = sqrt((double)-1);
if(errno){
perror("sqrt(-1) failed");
errno = 0;
} else{
......
}
syslog.h void syslog(int priority, char *formant,...);
//创建系统日志函数
8.使用库
nm 列出编入目标文件或者二进制文件的所有符号.
ldd 列出使程序正常运行所用到的库
ldconfig 维护/usr/lib 和/lib下共享库所需的运行的链接. /etc/ld.so.conf
ldconfig -v 更新缓存/etc/ld.so.cache
-p 打印缓存
ar 和 ranlib归档命令
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/17503/showart_111169.html |
|