[How to Solve] expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__

Today, when adding CRC check code to a piece of code, the following compilation error occurred:

Checking. C: in the function ‘get’_ Int ‘:
checking. C: 16: error: expected’ = ‘,’, ‘;’‘ asm’ or ‘__ attribute__’ Before ‘{‘ token
checking. C: 52: error: expected ‘=’, ‘,’; ‘‘ asm’ or ‘__ attribute__’ Before ‘{‘ token
checking. C: 67: error: expected ‘=’, ‘,’; ‘‘ asm’ or ‘__ attribute__’ Before ‘{‘ token
checking. C: 78: error: expected ‘=’, ‘,’; ‘‘ asm’ or ‘__ attribute__’ Before ‘{‘ token
checking. C: 97: error: old parameter declaration used in prototype function definition
checking. C: 97: error: expected ‘{‘ at end of input

It’s an error in 8.6 input confirmation when learning Chapter 8 of c primer plus

Extension: the following error reasons are seen on the Internet. Sort them out

1. Reason: compile cpp file with GCC. Solution: compile cpp file with G + +

Note: it’s easy to misuse GCC with makefile. I’ve encountered many similar problems… And when connecting, some versions of make like to connect with GCC and hang up directly. I usually add a sentence CC = G + + cflags = – x C in the head, which is very useful

2. Reason: missing “#” when including header file or function “{” and “}” do not appear in pairs

3. Reason: the new content conflicts with the header file

Note: error: expected ‘=’, ‘,’; ‘‘ asm’ or ‘__ attribute__’ If XXX is a class name, it is almost certain that your C file contains the C + + header file. It is this problem that the owner of the building encountered. The 10th floor method is not recommended. The best way is not to include C + + header files! If you need to use class in your C file, simply change the C file to cpp file directly. Missing punctuation is not the same as width

4.tyepdef int (*psum)(int,int);

Typodef is misspelled, as above, error: expected ‘=’, ‘,’; ‘‘ asm’ or ‘__ attribute__’ before ‘int’。

So in the end, it was found that one ‘;’ It’s caused by. ASM is a compiler

 

Similar Posts: