预处理器在声明unsigned int x并使用二进制常量初始化时进行编译

时间:2018-06-06 03:45:50

标签: c compilation int preprocessor unsigned

当我将变量声明为

时,我在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代码编译时没有问题的原因。

0 个答案:

没有答案