"error: expected primary-expression before 'volatile'"
"error: expected primary-expression before 'volatile'"
我正在尝试使用 MinGW 4.8.2 编译 NRF driver。我收到此错误:
在
包含的文件中
b:/nrfdriver/sdk/nRF51_SDK_8.1.0_b6ed55f/components/device/nrf51.h:119:0,
from b:/nrfdriver/sdk/nRF51_SDK_8.1.0_b6ed55f/components/softdevice/s130/headers/nrf_soc.h:50,
from b:/nrfdriver/pc-ble-driver-0.5.0/driver/inc_override/nrf_soc.h:21,
from b:/nrfdriver/pc-ble-driver-0.5.0/driver/inc_override/app_util_platform.h:26,
from b:/nrfdriver/sdk/nRF51_SDK_8.1.0_b6ed55f/components/drivers_nrf/uart/app_uart.h:27,
from b:\nrfdriver\pc-ble-driver-0.5.0\driver\src\app_uart_pc.c:13:
C:/MinGW/mingw64/lib/gcc/x86_64-w64-mingw32/4.8.2/include/xmmintrin.h:
In function 'void _mm_setcsr(unsigned int)':
b:/nrfdriver/sdk/nRF51_SDK_8.1.0_b6ed55f/components/toolchain/gcc/core_cm0.h:164:21:
error: expected primary-expression before 'volatile' #define __I
volatile /*!< Defines 'read only' permissions */
^ driver\CMakeFiles\s130_nrf51_ble_driver.dir\build.make:297: recipe for
target 'driver/CMakeFiles/s130_nrf51_ble_driver.dir/src/app_uart_pc.c
.obj' failed
错误来自这一行:
#define __I volatile /*!< Defines 'read only' permissions */
如此简单的 #define
怎么会导致编译器错误?知道我应该如何解决这个问题吗? (升级编译器不是一个选项,因为这个版本的驱动程序应该是用这个版本的 MinGW 构建的)。
请注意,该驱动程序旨在以 32 位构建,我正在尝试构建它以 64 位为目标,不知道是否这可能是问题的原因...
如果我们也查看 xmmintrin.h header 会怎么样?
/* Set the control register to I. */
extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mm_setcsr (unsigned int __I)
{
__builtin_ia32_ldmxcsr (__I);
}
哎呀,__I
.
的另一种用法
我正在尝试使用 MinGW 4.8.2 编译 NRF driver。我收到此错误:
在
包含的文件中b:/nrfdriver/sdk/nRF51_SDK_8.1.0_b6ed55f/components/device/nrf51.h:119:0,
from b:/nrfdriver/sdk/nRF51_SDK_8.1.0_b6ed55f/components/softdevice/s130/headers/nrf_soc.h:50,
from b:/nrfdriver/pc-ble-driver-0.5.0/driver/inc_override/nrf_soc.h:21,
from b:/nrfdriver/pc-ble-driver-0.5.0/driver/inc_override/app_util_platform.h:26,
from b:/nrfdriver/sdk/nRF51_SDK_8.1.0_b6ed55f/components/drivers_nrf/uart/app_uart.h:27,
from b:\nrfdriver\pc-ble-driver-0.5.0\driver\src\app_uart_pc.c:13:
C:/MinGW/mingw64/lib/gcc/x86_64-w64-mingw32/4.8.2/include/xmmintrin.h:
In function 'void _mm_setcsr(unsigned int)':
b:/nrfdriver/sdk/nRF51_SDK_8.1.0_b6ed55f/components/toolchain/gcc/core_cm0.h:164:21:
error: expected primary-expression before 'volatile' #define __I
volatile /*!< Defines 'read only' permissions */
^ driver\CMakeFiles\s130_nrf51_ble_driver.dir\build.make:297: recipe for
target 'driver/CMakeFiles/s130_nrf51_ble_driver.dir/src/app_uart_pc.c
.obj' failed
错误来自这一行:
#define __I volatile /*!< Defines 'read only' permissions */
如此简单的 #define
怎么会导致编译器错误?知道我应该如何解决这个问题吗? (升级编译器不是一个选项,因为这个版本的驱动程序应该是用这个版本的 MinGW 构建的)。
请注意,该驱动程序旨在以 32 位构建,我正在尝试构建它以 64 位为目标,不知道是否这可能是问题的原因...
如果我们也查看 xmmintrin.h header 会怎么样?
/* Set the control register to I. */
extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mm_setcsr (unsigned int __I)
{
__builtin_ia32_ldmxcsr (__I);
}
哎呀,__I
.