在Netbeans IDE 8.0.2中使用(得分下)“_”

时间:2015-05-22 03:18:33

标签: c++ netbeans

在头文件中我有一个功能

typedef std::vector<double> 1DVector
typedef std::vector<1DVector> 2Dvector
static void FuncA(2DVector& M, 2DVector& S, 2DVector& MSI);

在.cpp文件中

void ClassTemp::FuncA(2DVector& _M, 2DVector& _S, 2DVector& _MSI);

我正在使用netbeans IDE 8.0.2。当我编译这段代码时,我遇到了像

这样的错误
error: expected ',' or '...' before numeric constant

error: prototype for void void ClassTemp::FuncA(2DVector& _M, 2DVecto
r& _S, 2DVector& _MSI) does not match any in class ClassTemp.

error: candidate is void ClassTemp::FuncA(2DVector& _M, 2DVector& _S, 2DVector& _MSI)

我在网上搜索,发现这与_有关,但之前我用netbeans IDE 7.4成功编译了这段代码。任何帮助将不胜感激。

编辑:

我正在使用arm-linux-androideabi-g++编译器进行编译。

1 个答案:

答案 0 :(得分:1)

在C和C ++中,以下划线后跟大写字母开头的名称(例如,_M)保留用于语言实现。它们可以是#define d宏或用于内部语言实现类和函数的名称。因此,您不应该在自己的代码中使用它们,否则您可能会遇到奇怪的问题。我怀疑这就是问题所在。

尝试将变量重命名为使用小写m或删除下划线。 (作为单挑,同样的规则适用于以两个下划线开头的名称,所以不要尝试在前面添加另一个下划线。^ _ ^)

希望这有帮助!