NDK编译错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token
2011-11-15 21:22
671 查看
问题
编译NDK程序,提示错误“expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token“
解决
目前的经历来看,是编译C程序中有C++特性时会出现该错误。
原因清楚,解决就很简单,要么去掉C++特性,要么把扩展名改为CPP
还有一种情况要注意,就是obj目录下的以前编译的中间结果要删除干净,否则会造成误判,比如
1、做了一个A.c,编译通过
2、对A.c复制粘贴改名做出一个A.cpp
3、在A.cpp的头文件里加了一个类,再去编译,就会出现这个expected的错误。
原因不是很清楚,猜测是因为obj没清理,实际上build系统还是去编译A.c,因为A.c和A.cpp实际上用的是一个头文件(这个头文件里已经定义了一个类),此时build系统会发现这个C程序里有C++特性,就会报这个错误。
编译NDK程序,提示错误“expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token“
解决
目前的经历来看,是编译C程序中有C++特性时会出现该错误。
原因清楚,解决就很简单,要么去掉C++特性,要么把扩展名改为CPP
还有一种情况要注意,就是obj目录下的以前编译的中间结果要删除干净,否则会造成误判,比如
1、做了一个A.c,编译通过
2、对A.c复制粘贴改名做出一个A.cpp
3、在A.cpp的头文件里加了一个类,再去编译,就会出现这个expected的错误。
原因不是很清楚,猜测是因为obj没清理,实际上build系统还是去编译A.c,因为A.c和A.cpp实际上用的是一个头文件(这个头文件里已经定义了一个类),此时build系统会发现这个C程序里有C++特性,就会报这个错误。
相关文章推荐
- 提示错误“expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token“
- 提示错误“expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token“
- expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token 或者 before ‘{’ token
- 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
- clientglobalextern.h:31: 错误:为形参 ‘SVS_CLI_CONTEXT’ 指定了存储类 ksvs_client.c:40: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
- expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token 或者 before ‘{’ token
- :expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token 解决办法
- gcc编译,出现错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ........
- 编译错误:error: expected '=', ',', ';', 'asm' or '__attribute__' before...
- logic.c:1:9: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token
- Objective-C编译错误:expected '=', ',', ';', 'asm' or '__attribute__' before ***
- expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token
- logic.c:1:9: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token
- C -- error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
- 【编程经验】错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘namespace’
- /usr/include/ctype.h:48: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘enum’
- Android error: expected '=', ',', ';', 'asm' or '_attribute_' before '==' token
- 在Ubuntu gcc下编译c程序,错误如下: test.c:3: error: expected ';', ',' or ')' before '&' token
- expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token gcc编译错误
- error: expected '=', ',', ';', 'asm' or '__attribute__' before 'WINAPI' 编译问题