This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Warning messages

I have function with 3 parameters passed in.
The same funtion i am calling in other function and passing the 3 parameters but i get a warning message.

too few actual parameters.

Since the original function and function where i call the old function and passing the parameters are same,I couldnt understand why this warning message has come.How to rectify this warning message.
Please help me.

Parents
  • The below code is under file called ADC.c. This is original function.

    void SetVoltage(unsigned char byChannel, float fOldVcc, float fNewVcc)
    {
    signed int byOldVccHex = 0x0000;
    signed int byNewVccHex = 0x0000;
    signed int byRamp = 0x0000;
    signed int VccHex = 0x0000;
    signed int VccHexCal = 0x0000;

    signed char VccHex_Upper = 0x00;
    signed char VccHex_Lower = 0x00;

    float fSetVref = 10.0;
    float fSetGain = 1.0;
    float fSetOffset = 0.0;
    ..........}

    The below funtion is in the file SeqUp.c. In this file in SeqUpVDD() function i call the function from ADC.c(which is shown above)and pass the parameters. The parameters passed are declared same as that of the original function.

    void SeqUpVDD(void)
    {
    SetVoltage(5,fLastVDD,fNewVDD);
    fLastVDD = fNewVDD;

    return;
    }

    Upon compiling there is a warning message ,

    too few actual parameters.

    Please help me to solve this issue.

Reply
  • The below code is under file called ADC.c. This is original function.

    void SetVoltage(unsigned char byChannel, float fOldVcc, float fNewVcc)
    {
    signed int byOldVccHex = 0x0000;
    signed int byNewVccHex = 0x0000;
    signed int byRamp = 0x0000;
    signed int VccHex = 0x0000;
    signed int VccHexCal = 0x0000;

    signed char VccHex_Upper = 0x00;
    signed char VccHex_Lower = 0x00;

    float fSetVref = 10.0;
    float fSetGain = 1.0;
    float fSetOffset = 0.0;
    ..........}

    The below funtion is in the file SeqUp.c. In this file in SeqUpVDD() function i call the function from ADC.c(which is shown above)and pass the parameters. The parameters passed are declared same as that of the original function.

    void SeqUpVDD(void)
    {
    SetVoltage(5,fLastVDD,fNewVDD);
    fLastVDD = fNewVDD;

    return;
    }

    Upon compiling there is a warning message ,

    too few actual parameters.

    Please help me to solve this issue.

Children
  • How does SeqUp.c come to know about SetVoltage()? Is SetVoltage() declared in some header (.h) file? If so, how is it declared in that header file? Does SetVoltage()'s declaration in that header file match SetVoltage()'s definition in ADC.c?

  • Thank you very much.

    There was a mistake in the header file decalration of the function.

  • There was a mistake in the header file decalration of the function.

    And the fact it was so hard to find is that you failed to abide by the 4 commandments of multi-file C programming:

    0) There shall be (at least) one header file for every .c file, with the possible exception of a project's "main.c".

    1) Every object with external linkage except main() shall be declared exactly once, and this declaration shall be in a header file.

    2) Never put a definition in a header.

    3) Every module must #include its own header(s), and this #include had better be the first non-comment line of the entire source file. Don't put obstacles between the fellow programmer and your header file.

    4) Never use the keyword "extern" in a .c file. Whenever you feel tempted to do that, #include the relevant header instead.

    5) Every header file has to be self-contained and idempotent. I.e. it has to be possible to compile the header all by itself, without special compiler switches or previous #includes, and it has to be possible to #include it as many times as you like, without ill effects.