This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

WHY , THIS ERROR: Error[Pe109]: expression preceding parentheses of apparent call must have (pointer-to-) function type F:\Documents and Settings\Juan Pedro\Escritorio\renuevo\netapp.c 196

Other Parts Discussed in Thread: MSP430FR5739

Hy, my name is JuanP

I have a doubt over programming in MSP430FR5739 & CC3000. I use iar 6.20

In the header of the file "A" have this:

#define HEADERS_SIZE_CMD      9     , (SPI_HEADER_SIZE + SIMPLE_LINK_HCI_CMND_HEADER_SIZE ) ,(5+4)

in the other file, I have :   #include "fileA.h" and the line :

args = (ptr + HEADERS_SIZE_CMD);  BUT  no working, only working if args = (ptr + 9);  

I do not understand why.

regards

JP

  •  Hi Juan Pedro, please write a more precise title to your request and not so long.

    user3889415 said:

    no working, only working if args = (ptr + 9);  

     This assign a constant value summed to and has no problem

    user3889415 said:
    args = (ptr + HEADERS_SIZE_CMD);

     This is invoking a macro or string substitution require some parameter, this case, as compiler ask you some parameter are to be supplied.

     Search for macro usage to see how it work, it is unrelated to MSP, is a pure C error.

  • Take "HEADERS_SIZE_CMD" and replace it with _all_ the text (until end of line) after "#define HEADERS_SIZE_CMD "
    This is what the precompiler does. and the result is what the compiler sees - and complains about (rightfully):
    args = (ptr + 9 , (SPI_HEADER_SIZE + SIMPLE_LINK_HCI_CMND_HEADER_SIZE ) ,(5+4) );
    It would work for a function call
    func(ptr+ HEADERS_SIZE_CMD);
    if func() takes three parameters. But it won't work for an assignment.

    you could also do
    #define ARGS (ptr + HEADERS_SIZE_COMMAND)
    and then do
    func(ARGS);
    because ARGS will be replaced by its definition, and inside this definition, HEADERS_SIZE_COMMAND will be replaced by its definition, and inside it, SPI_HEADER_SIZE etc. will be replaced by its definition. All done before the resulting text is fed into the compiler.
    (btw: #include is also just replaced by the text content of the named file, as if it had been copy&paste in there.)
  • thank for the information, I understand the error,I am a newbie and my questions may seem silly, but important for me, thanks again

    Regards
    JuanPedro
  • Even experts often do not fully understand how the preprocessor works, and which source code the compiler really sees after preprocessing.
    You can do lots of things with the preprocessor, if used right. But it will also obfuscate many things and sometimes throw unexplainable errors if not used right, or if preprocessor macros are used in a way they weren't designed for. And then it is difficult to debug.

**Attention** This is a public forum