Unexpected list of macroformal parameters Error

I am a trainee student, and my boss said that I need to port from Linux c to Visual C ++.

When I built the encoding, I found that this error was "unexpected in the list of formats of macroformal formats", here is the code

#define cache_info(format, msg...)  
    do { \
        ;\
    } while (0)  

I do not know what is wrong and what the encoding is for.

I can not ask the Linux programmer since it does not work. Can someone help me ???

+3
source share
3 answers

It appears that your version of Visual C ++ does not support variable macros.

you may need to try something like this to make it work.

#define FUNC(foo)  ThisFunc foo

void ThisFunc(int, ...);

int main()
{
    FUNC((123, 456));
}

or can you just skip the comma? ....

#define cache_info(format, msg,...)  
+6
source

I think the problem can be one of two things.

-,

cache_info(format, msg...)

, ,

cache_info(format, msg, ...)

​​ .

, ( "variadic macros" ) ++; C. C- ++, , ++.

+2

if you are using Windows 64-bit OS and visual studio, try running this file bat: \ Program Files (x86) \ Microsoft Visual Studio 9.0 \ Common7 \ Tools \ vsvars32.bat

It will register env settings. It worked for me.

0
source

Source: https://habr.com/ru/post/1795650/


All Articles