首页 > 解决方案 > 预处理器在声明 unsigned int x 并使用二进制常量初始化时进行编译

问题描述

当我将变量声明为时,我在 Pro* C 预编译中遇到错误

unsigned int x = 0b00001;
unsigned int y = 0b00010;
unsigned int z = 0b00100;

当 pro*c 中发生预编译时,错误是

    ....................1
    PCC-S-02201, Encountered the symbol "B00001" when expecting one of the following
    :

       ; , = ( [ * ? | & < > + - / % . ^ *= /= %= += -= <<= >>= &&=
       ||= ^= | & == != <= >= << >> ++ -- ->
    The symbol ";" was substituted for "B00001" to continue.

    GCC version is 
    gcc version 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC)`enter code here`

当我尝试将此代码作为不同文件中的普通 C 代码运行时,它工作得很好。该问题仅在运行 pro*c 代码时发生。

所以,我想了解编译proc代码时的确切问题是什么,以及为什么编译C代码时没有问题。

标签: ccompilationintpreprocessorunsigned

解决方案


推荐阅读