C/C++
文章平均质量分 72
Hao_Ding
这个作者很懒,什么都没留下…
展开
-
How to write a shell script to check the return value of main()
Just one example.test_error.cpp containing the main function:#includeusing namespace std;int main(){ cout<<"This is just for an error simulation"<<endl; return 12;}Get an simple a.out, aft原创 2013-07-08 06:24:05 · 1087 阅读 · 0 评论 -
如何使用gdb进行调试
GNU C++中可以在编译的中间阶段暂停,具体分为:-E 预处理之后停止,未编译;-S 编译产生汇编代码后停止,未汇编;-C 汇编产生机器代码后停止,未链接。调试之前,需要使用-g选项在目标代码中增加信息,产生目标代码的调试信息,然后将其装入调试器,如:$ g++ -g -o helloworld helloworld.cpp$ gdb helloworld...(g原创 2013-07-10 05:04:14 · 1171 阅读 · 0 评论 -
如何编写Makefile文件
节选自:《Linux C编程一站式学习》首先展示一个完整的Makefile文件:main : main.o stack.o maze.o gcc main.o stack.o maze.o -o mainmain.o : main.c main.h stack.h maze.h gcc -c main.cstack.o : stack.c stack.h m转载 2013-07-04 04:28:42 · 1132 阅读 · 0 评论 -
linux下调用fork()生成进程的一些细节
fork can be seen as an copy of one existing execution. parent and child share the code. the difference is the return value: 0 and the id of the child process. Why? resourcesfork example:#inc原创 2013-07-22 01:26:27 · 1246 阅读 · 0 评论 -
如何分别为Beaglebone与PC安装Wt
在Beaglebone上安装前需要先查看其上的glic的版本,至少是v1.15,不然不能运行wt.如果不是,可以去http://downloads.angstrom-distribution.org/demo/beaglebone/上下载原创 2013-07-05 17:28:07 · 1417 阅读 · 0 评论 -
C++中的内联函数
内联函数使用inline关键字来定义,如inline int func(int i){return i+1;} 如上例所示,不能将内联函数的declaration与definition分开。 在class的内部有函数体的函数都会被默认为是内联函数,不管是否有inline关键字;在class外部,如果想将class内的某一个函数定义为内联函数,则可在definit原创 2013-07-28 06:56:08 · 940 阅读 · 0 评论