-1
我想在gnu-linux操作系统中编译一个c文件,但是当我尝试编译这些代码时,编译器给了我一些错误。为什么我在c程序中遇到流浪'342'错误?
我op.c文件是:
#include <stdio.h>
int main(int argc, char *argv[]){
int i;
for (i=0; i < argc; i++){
printf(“command line argument [%d] = %s \n”, i, argv[i]);
}
return 0;
}
当我尝试编译这段代码,我得到这些错误。我该如何解决它们?
op.c: In function ‘main’:
op.c:6:3: error: stray ‘\342’ in program
printf(“command line argument [%d] = %s \n”, i, argv[i]);
^
op.c:6:3: error: stray ‘\200’ in program
op.c:6:3: error: stray ‘\234’ in program
op.c:6:13: error: ‘command’ undeclared (first use in this function)
printf(“command line argument [%d] = %s \n”, i, argv[i]);
^
op.c:6:13: note: each undeclared identifier is reported only once for each function it appears in
op.c:6:21: error: expected ‘)’ before ‘line’
printf(“command line argument [%d] = %s \n”, i, argv[i]);
^
op.c:6:21: error: stray ‘\’ in program
op.c:6:21: error: stray ‘\342’ in program
op.c:6:21: error: stray ‘\200’ in program
op.c:6:21: error: stray ‘\235’ in program
在此先感谢您。
不能使用在源文件中的 “智能” 引号。 –
编译器错误的第一件事是不要进入Stack Overflow并询问它,但要在Google搜索中输入确切的错误并打开第一个链接。 –
这些错误来自源代码中的扩展ASCII字符,这是语法所不允许的。 –