cygwin 终端中意外标记 `(' 附近的语法错误
syntax error near unexpected token `(' in cygwin terminal
我是运行下面的c程序,在windowsOS中使用cygwin终端的fork()系统调用相关!我收到以下错误!我该如何纠正?
./fork.cpp: line 3: syntax error near unexpected token `('
'/fork.cpp: line 3: `int main(int argcc,char *argv[])
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
# include<conio.h>
int main(int argcc,char *argv[])
{
printf("I m %d\n",(int) getpid());
pid_t pid = fork();
printf("Fork returned: %d\n", (int) pid);
printf("I am %d\n, (int) getpid());
getch();
}
你应该说明它给你错误的那一行,但我假设它是这个语句:printf("I am %d\n, (int) getpid()); since you have not put the closing quotes in the printf statement "。意外的标记 `(' 是 ( 就在 int 之前,因为编译器正在寻找结束引号但找不到它们。
我是运行下面的c程序,在windowsOS中使用cygwin终端的fork()系统调用相关!我收到以下错误!我该如何纠正?
./fork.cpp: line 3: syntax error near unexpected token `('
'/fork.cpp: line 3: `int main(int argcc,char *argv[])
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
# include<conio.h>
int main(int argcc,char *argv[])
{
printf("I m %d\n",(int) getpid());
pid_t pid = fork();
printf("Fork returned: %d\n", (int) pid);
printf("I am %d\n, (int) getpid());
getch();
}
你应该说明它给你错误的那一行,但我假设它是这个语句:printf("I am %d\n, (int) getpid()); since you have not put the closing quotes in the printf statement "。意外的标记 `(' 是 ( 就在 int 之前,因为编译器正在寻找结束引号但找不到它们。