【Reproduced】Compile error: expected = asm or attribute before token

Reprinted from: https://blog.csdn.net/zz962/article/details/6974575

Problem
When compiling NDK program, it prompts the error "expected '=', ',', ';', 'asm' or ' attribute ' before '<' token"

to solve
the current experience, it is when compiling C program with C++ features This error occurs.
The reason is clear, the solution is very simple, either remove the C++ feature, or change the extension to CPP

There is also a situation to pay attention to, that is, the intermediate results of the previous compilation in the obj directory should be deleted, otherwise it will cause misjudgment, such as
1. Make an Ac, compile through
2. Copy and paste the Ac and rename it to make an A.cpp
3. Add a class to the header file of A.cpp, and then compile it, the expected error will appear.
The reason is not very clear. I guess it is because the obj is not cleaned up. In fact, the build system still compiles Ac, because Ac and A.cpp actually use a header file (a class is already defined in this header file). At this time, build The system will find that the C program has C++ features and will report this error.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326562325&siteId=291194637
ASM