C++ 编译wxMathPlot时出错

C++ 编译wxMathPlot时出错,c++,windows,visual-studio-2010,wxmathplot,C++,Windows,Visual Studio 2010,Wxmathplot,以下是之前发布的问题: 最好的答案是只需将mathplot.h和mathplot.cpp文件添加到项目中,然后它就可以工作了 但是,在visual Studio 2010中将这两个文件添加到我的项目中(通过右键单击我的项目->添加->现有项并选择这两个文件)并尝试编译后,我会出现以下错误: 1> mathplot.cpp 1>mathplot.cpp(133): warning C4100: 'event' : unreferenced formal parameter 1>

以下是之前发布的问题:

最好的答案是只需将mathplot.h和mathplot.cpp文件添加到项目中,然后它就可以工作了

但是,在visual Studio 2010中将这两个文件添加到我的项目中(通过右键单击我的项目->添加->现有项并选择这两个文件)并尝试编译后,我会出现以下错误:

1>  mathplot.cpp
1>mathplot.cpp(133): warning C4100: 'event' : unreferenced formal parameter
1>mathplot.cpp(133): warning C4100: 'w' : unreferenced formal parameter
1>mathplot.cpp(278): warning C4100: 'event' : unreferenced formal parameter
1>mathplot.cpp(278): warning C4100: 'w' : unreferenced formal parameter
1>mathplot.cpp(2239): warning C4996: 'wxImage::SaveFile': was declared deprecated
1>mathplot.cpp(2610): error C2589: 'if' : illegal token on right side of '::'
1>mathplot.cpp(2610): error C2143: syntax error : missing ';' before '::'
1>mathplot.cpp(2610): error C2143: syntax error : missing ';' before '{'
1>mathplot.cpp(2610): error C2181: illegal else without matching if
1>mathplot.cpp(2749): error C2589: 'if' : illegal token on right side of '::'
1>mathplot.cpp(2749): error C2143: syntax error : missing ';' before '::'
1>mathplot.cpp(2749): error C2143: syntax error : missing ';' before '{'
1>mathplot.cpp(2749): error C2181: illegal else without matching if
1>mathplot.cpp(2750): error C2589: 'if' : illegal token on right side of '::'
1>mathplot.cpp(2750): error C2143: syntax error : missing ';' before '::'
1>mathplot.cpp(2750): error C2143: syntax error : missing ';' before '{'
1>mathplot.cpp(2750): error C2181: illegal else without matching if
1>mathplot.cpp(2751): error C2589: 'if' : illegal token on right side of '::'
1>mathplot.cpp(2751): error C2143: syntax error : missing ';' before '::'
1>mathplot.cpp(2751): error C2143: syntax error : missing ';' before '{'
1>mathplot.cpp(2751): error C2181: illegal else without matching if
1>mathplot.cpp(2763): error C2589: 'if' : illegal token on right side of '::'
1>mathplot.cpp(2763): error C2143: syntax error : missing ';' before '::'
1>mathplot.cpp(2763): error C2143: syntax error : missing ';' before '{'
1>mathplot.cpp(2763): error C2181: illegal else without matching if
1>mathplot.cpp(2847): error C2589: 'if' : illegal token on right side of '::'
1>mathplot.cpp(2847): error C2143: syntax error : missing ';' before '::'
1>mathplot.cpp(2847): error C2143: syntax error : missing ';' before '{'
1>mathplot.cpp(2847): error C2181: illegal else without matching if
1>mathplot.cpp(2877): error C2589: 'if' : illegal token on right side of '::'
1>mathplot.cpp(2877): error C2143: syntax error : missing ';' before '::'
1>mathplot.cpp(2877): error C2143: syntax error : missing ';' before '{'
1>mathplot.cpp(2877): error C2181: illegal else without matching if

如何修复此问题?

在mathplot.cpp文件中,我已更改了所有设置 :wxLogErrorwxLogError


并注释掉行#define new DEBUG\u new,然后它成功编译

wxLogError实际上是一个以“if(..)开头的预处理器宏,因此::if(将导致语法错误。使用预处理器重新定义new也是非常糟糕的。