Cant solve this simple error!

hello everyone.. i just registered to this forum and as you can see i am a beginner..

this is my code..

1
2
3
4
5
6
7
8
9
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>

int main(void)
{
printf("PID=%d PPID=%d\n", getpid(), getppid() );
return 0;
}


its a code for linux shell scripting.. anyway.. the problem is that i keep getting the error

line 5: syntax error near unexpected token `('
line 5: `int main(void)'

can someone help me with this? everything i tried wont solve it..
any help would be appreciated!
It seems that the code is valid. Maybe the problem is hidden in headers. Try to remove headers at first and then add them one by one to see waht is the problem.

Start with empty body of main

1
2
3
4
5
6
7
8
9
/*#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
*/
int main(void)
{
/*printf("PID=%d PPID=%d\n", getpid(), getppid() ); */
return 0;
}


and check is there an error. Then add for example header <stdio.h>

1
2
3
4
5
6
7
8
9
#include <stdio.h>
/*#include <sys/types.h>
#include <unistd.h>
*/
int main(void)
{
/*printf("PID=%d PPID=%d\n", getpid(), getppid() ); */
return 0;
}


and again check is there an error. And so on until you will locate the error.
Topic archived. No new replies allowed.