在 Netbeans IDE 8.0.2 中使用(低于分数)"_"

Using (under score) "_" in Netbeans IDE 8.0.2

本文关键字:IDE Netbeans      更新时间:2023-10-16

在头文件中我有一个函数

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++编译器编译

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

尝试重命名变量以使用小写的m或去掉下划线。(提醒一下,同样的规则也适用于以两个下划线开头的名称,所以不要尝试在前面添加另一个下划线。^ _ ^)

希望这对你有帮助!