- 论坛徽章:
- 0
|
请问各位大神,如果编译通过了,可是程序运行出错。应该如何进行调试。而且我此次运行程序出错的原因不知是为什么。废话不多说,直接上问题。
下面为运行时的错误信息:
第一次运行: . ./main
ksh: 0403-057 Syntax error: `(' is not expected.
重新编译后,第二次运行: . ./main
ksh: 0403-057 Syntax error: `do' is not expected.
编译的命令
cc -s funtion.so -c main.c -o main
程序代码:
/*************************************
* name: main.c
* 本程序主要是测试Linux IPC 进程间的通信
*
* time:2014-8-27
*************************************/
#include "pbheader.h"
#include "funtion.h"
int main ()
{
pid_t pid;
TELL_WAIT();
if( (pid=fork() ) < 0 )
ErrorDump("fork","fork error");
else if (pid == 0 ) /* child */
{
printf(" do something !\n");
sleep(5);
printf("done !\n");
TELL_PARENT( getppid() );
}
else /* parent */
{
WAIT_CHILD();
printf("I get it \n");
}
if ( waitpid(pid,NULL,0) != pid )
ErrorDump("waitpid","error" );
return 0;
}
最后补充:由于程序写的比较简单,所以核查了多遍没找出问题。才请大神支招 |
|