C语言 编译错误“在 '<' 标记之前应为 '='、'、'、';'、'asm' 或 '__attribute__'”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16965066/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 06:36:32  来源:igfitidea点击:

Compilation error "expected '=', ',', ';', 'asm' or '__attribute__' before '<' token"

c

提问by Angus

#include<stdio.h>
int main(){
 register int i = 0;
 for(i=0;i < 10; i++){
   printf("\n i : %d  \n",i);
 }
 return 0;
}

I was trying a sample program of registers use in the loop counter.

我正在尝试在循环计数器中使用寄存器的示例程序。

I'm getting the following error while trying to compile the program,

尝试编译程序时出现以下错误,

register.c:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token

How to fix this compilation error.

如何修复此编译错误。

回答by SubSevn

Try #include <stdio.h>You need the #.

试试#include <stdio.h>你需要#。

回答by kandelvijaya

Everything is fine but you could put a space at

一切都很好,但你可以在

#include <stdio.h>

Hope that works or theres something wrong with compiler: maybe

希望有效或编译器有问题:也许