Error: expected '=', ',', ',' 'asm' or ' _attribute_' before '<' token in C

Here, we will learn why an Error: expected '=', ',', ',' 'asm' or ' _attribute_' before '<' token is occurred and how to fix it in C programming language?
By IncludeHelp Last updated : March 10, 2024

A very common error in C programming language, it occurs when # is not used before the include.

Error: expected '=', ',', ',' 'asm' or ' _attribute_' before '<' token

As we know that #include is a preprocessor directive and it is used to include a header file's code to the program. But, include is nothing without #, it is not valid and it cannot be used to include a header file in the program.

Example

include <stdio.h>

int main(void) {
	printf("Hello world!");
	return 0;
}

Output

prog.c:1:9: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token
 include <stdio.h>
         ^

How to fix?

To fix this error - use #include.

Correct Code

#include <stdio.h>

int main(void) {
	printf("Hello world!");
	return 0;
}

Output

Hello world!

C Common Errors Programs »

Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.