gpt4 book ai didi

编译错误: 'expected expression' while editing Linux pre-processor statment

转载 作者:行者123 更新时间:2023-11-30 16:25:58 29 4
gpt4 key购买 nike

我正在尝试向某些每处理器代码添加条件语句,但我不确定为什么它无法编译。这是未更改的代码:

static struct i2c_board_info ccwmx51_i2c_devices[] __initdata = {

{
// Use erdigitemp2 driver for device id 0x48 (digital temperature sensor)
I2C_BOARD_INFO("erdigitemp2", 0x48)
},
{
// Use erdigitemp2 driver for device id 0x4c (digital temperature sensor)
I2C_BOARD_INFO("erdigitemp2", 0x4c)
},
{
// Use tvp5150 driver for device id 0x5c (camera decoder)
I2C_BOARD_INFO("tvp5150tj", 0xb8 >> 1)
},
#if defined(CONFIG_TJTKMJ_LSM303DLHC)
{
// STMICROELECTRONICS LSM303DLHC e-compass
// accelerometer
I2C_BOARD_INFO("lsm303dlhc_acc", 0x19)
},
{
// magnetometer
I2C_BOARD_INFO("lsm303dlhc_mag", 0x1e)
},
#endif
#if defined(CONFIG_INPUT_MMA7455L) || defined(CONFIG_INPUT_MMA7455L_MODULE)
{
I2C_BOARD_INFO("mma7455l", 0x1d),
.irq = IOMUX_TO_IRQ(MX51_PIN_GPIO1_7),
},
#endif
#if defined(CONFIG_SND_SOC_IMX_CCWMX51_WM8753) || defined(CONFIG_SND_SOC_IMX_CCWMX51_WM8753_MODULE)
{
I2C_BOARD_INFO("wm8753", 0x1A),
},
#endif
#if defined (CONFIG_MXC_CAMERA_MICRON111_1) || defined(CONFIG_MXC_CAMERA_MICRON111_1_MODULE)
{
I2C_BOARD_INFO("mt9v111_1", 0xB8>>1),
},
#endif
#if defined (CONFIG_MXC_CAMERA_MICRON111_2) || defined(CONFIG_MXC_CAMERA_MICRON111_2_MODULE)
{
I2C_BOARD_INFO("mt9v111_2", 0x90>>1),
},
#endif
};

我的修改是一个简单的 if 语句:

if (hardware_id() == 0) {
#if defined(CONFIG_SND_SOC_IMX_CCWMX51_WM8753) || defined(CONFIG_SND_SOC_IMX_CCWMX51_WM8753_MODULE)
{
I2C_BOARD_INFO("wm8753", 0x1A),
},
#endif
}

编译器错误是:

错误:“if”之前的预期表达式

最佳答案

我不确定这是否能解决您的问题,但它至少应该可以编译。

#if defined(CONFIG_SND_SOC_IMX_CCWMX51_WM8753) || defined(CONFIG_SND_SOC_IMX_CCWMX51_WM8753_MODULE)
if (hardware_id() == 0){
I2C_BOARD_INFO("wm8753", 0x1A),
}else{
//something
},
#endif

关于编译错误: 'expected expression' while editing Linux pre-processor statment,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53217243/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com