错误#92:标识符列表参数只能用于在函数定义 [英] Error #92: Identifier-List Parameters May Only Be Used In A Function Definition

查看:4848
本文介绍了错误#92:标识符列表参数只能用于在函数定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图编译一些code,但我遇到了一些问题,我似乎无法弄清楚。本来,我有三个错误,但我已经把范围缩小到一个,我似乎无法来解决。有三个文件,我现在有工作:voltcon.c,mss_ace.c和mss_ace.h。我已经粘贴下面的相关code:

I am attempting to compile some code, but am running into some problems that I cannot seem to figure out. Originally, I had three errors, but I have narrowed it down to one that I cannot seem to solve. There are three files I am working with right now: voltcon.c, mss_ace.c, and mss_ace.h. I have pasted the relevant code below:

在mss_ace.c

Within mss_ace.c

    void ACE_init( void )
    {
    /* Initialize driver's internal data. */
        ace_init_flags();

    /* Initialize the data structures used by conversion functions. */
    ace_init_convert();
    }

    void ACE_configure_sdd
    (
sdd_id_t            sdd_id,
sdd_resolution_t    resolution,
    uint8_t             mode,
    sdd_update_method_t sync_update
    )
    {
    ...
    }

在mss_ace.h

Within mss_ace.h

    typedef enum
    {
        SDD0_OUT = 0,    /*!< Analog Module 0 Sigma Delta DAC */
        SDD1_OUT = 1,    /*!< Analog Module 1 Sigma Delta DAC */
        SDD2_OUT = 2,    /*!< Analog Module 2 Sigma Delta DAC */
        NB_OF_SDD = 3
    } sdd_id_t;

    typedef enum
    {
        SDD_8_BITS = 0,
        SDD_16_BITS = 4,
        SDD_24_BITS = 8
    } sdd_resolution_t;

    #define SDD_CURRENT_MODE    1
    #define SDD_VOLTAGE_MODE    0
    #define SDD_RETURN_TO_ZERO  0
    #define SDD_NON_RTZ         2

    typedef enum
    {
        INDIVIDUAL_UPDATE = 0,
        SYNC_UPDATE = 1
    } sdd_update_method_t;

    void ACE_init(void);

    void ACE_configure_sdd(sdd_id_t sdd_id, sdd_resolution_t resolution, uint8_t mode, sdd_update_method_t sync_update);

在voltcon.c

Within voltcon.c

    #include <stdint.h>
    #include <math.h>
    #include <string.h>
    #include <stdio.h>
    #include "../../N3V2_hardware/biarri/firmware/drivers/mss_ace/mss_ace.h"

    sdd_id_t this_sdd_id = SDD0_OUT;
    sdd_resolution_t this_sdd_resolution = SDD_16_BITS;
    uint8_t this_mode = SDD_VOLTAGE_MODE;
    sdd_update_method_t this_sdd_update_method = INDIVIDUAL_UPDATE;

    void ACE_init();

    void ACE_configure_sdd(this_sdd_id, this_sdd_resolution, this_mode, this_sdd_update_method);

我得到的错误如下:

The error I am getting is as follows:

voltcon.c:错误:#92:标识符表参数只能在函数定义中使用

voltcon.c: error: #92: identifier-list parameters may only be used in a function definition

这是什么错误对我说的是,它可能有与第三个参数我的功能做的。

What this error says to me is that it probably has to do with the third argument to my function.

--- ---更新
错误是由在code(空隙ACE_configure_sdd一个)中的最后一行造成的。我上道歉。在#92只是一个code,它并不是指code的实际行。

---Update--- The error is caused by the last line in the code (the void ACE_configure_sdd one). My apologies on that. The #92 is just a code, it doesn't refer to the actual lines of code.

推荐答案

尝试从删除 ACE_configure_sdd 的声明 voltcon.c 。由于它已经存在于 mss_ace.h

Try deleting the declaration of ACE_configure_sdd from voltcon.c. As it is already there in mss_ace.h.

似乎您试图调用 ACE_configure_sdd voltcon.c Ç 你只能从另一个函数中调用一个函数。

It seems you are trying to call ACE_configure_sdd from voltcon.c but in c you can only call a function from inside of another function.

您可以尝试这样做 voltcon.c

void func1()
{
ACE_configure_sdd(this_sdd_id, this_sdd_resolution, this_mode, this_sdd_update_method);
}

现在FUNC1可以从其他一些功能,在你的code或主()本身调用。
希望这有助于。

now func1 can be called from some other function in your code or main() itself. Hope this helps.

这篇关于错误#92:标识符列表参数只能用于在函数定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆