linux c/c++ beginer

XEmacs

Editors in the Linux environment are usually completely separated from compilers and compiler tools, such as make. Source code is written with a text editor and the source file is compiled afterwards.
There are also editors that integrate compilers so that the compiling can be carried out within the editor. One such editor is XEmacs. In order to use XEmacs conveniently, the .profile file in user's home directory should contain the following lines:

PATH="$PATH:/opt/xemacs/bin"
export PATH

After this modification XEmacs editor can be executed with a command xemacs. For additional information on XEmacs, please visit www.xemacs.org.


GCC

Compiling "C" And "C++" Programs On Unix Systems - gcc/g++
http://users.actcom.co.il/~choo/lupg/tutorials/c-on-unix/c-on-unix.html

GCC how to
http://doc.99net.net/doc/soft/1076980860/index.html


列一:fork.c

#include
#include
#include

void main(void)
{
pid_t pid;

printf("hello/n");
pid = fork();

switch (pid) {
case -1: printf("failure!/n"); break;
case 0: printf("I am child!/n"); break;
default: printf("my child is %d/n",pid); break;
}
for (; ; ) { /* do something here */ }
}

编译:

gcc -o ex1 fork.c

执行结果:

./ex1 &

hello
my child is 8650
I am child!

C++ Reference Guide
http://www.informit.com/guides/guide.asp?g=cplusplus&rl=1

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值