error C2275 illegal use of this type as an expression 解决方法

来源:互联网 发布:单片机串行通信 编辑:程序博客网 时间:2024/04/27 15:59

在VC中编译xxx.c文件出现错误error C2275 illegal use of this type as an expression 

问题在于C99之前要求所有的声明必须放在函数块的起始部分,这也是C和C++的重要区别。

方法: 1). 修改成xxx.cpp 。 2). 把声明放在函数起始部分。

参考:http://stackoverflow.com/questions/9549521/compiler-error-c2275