开发者

Unexpected in macro formal parameter list Error

I'm an intern student and my boss told me to do porting from Linux c to Visual C++.

When I built the coding, I found this error "unexpected in macro formal parameter list", here is the code

#define cache_info(format, msg...)  
开发者_如何学JAVA    do { \
        ;\
    } while (0)  

I don't know what is wrong and what the coding is for .

I can't also ask the Linux programmer since he is out. Can someone help me ???


Sounds like your version of Visual C++ doesn't support variadic macros.

you might need to try something like this to get it to work.

#define FUNC(foo)  ThisFunc foo

void ThisFunc(int, ...);

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

or you could just be missing a comma?....

#define cache_info(format, msg,...)  


I think that the problem could be from one of two things.

First, your macro is defined as

cache_info(format, msg...)

But you probably meant to write

cache_info(format, msg, ...)

Though this could just be a typo in your original post.

More importantly, though, macros with variable numbers of arguments ("variadic macros") are not supported in C++; they exist only in C. If you're trying to compile this C code with a C++ compiler, the compiler should give you an error here because the code isn't legal C++.


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

It will register env settings. It worked for me..

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜