[英]Using (under score) “_” in Netbeans IDE 8.0.2
In header files i have a function 在头文件中,我有一个功能
typedef std::vector<double> 1DVector
typedef std::vector<1DVector> 2Dvector
static void FuncA(2DVector& M, 2DVector& S, 2DVector& MSI);
in .cpp file 在.cpp文件中
void ClassTemp::FuncA(2DVector& _M, 2DVector& _S, 2DVector& _MSI);
I am using netbeans IDE 8.0.2. 我正在使用netbeans IDE 8.0.2。 When i am compiling this code, I am getting errors like 当我编译此代码时,出现类似以下错误
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)
I searched on net and found that this is related with _
, but previously I successfully compiled this code with netbeans IDE 7.4. 我在网上搜索,发现这与_
有关,但是以前我已使用netbeans IDE 7.4成功编译了此代码。 Any help will be appreciated. 任何帮助将不胜感激。
EDIT: 编辑:
I am compiling with arm-linux-androideabi-g++
compiler. 我正在使用arm-linux-androideabi-g++
编译器进行编译。
In C and C++, names starting with an underscore followed by a capital letter (for example, _M
) are reserved for the language implementation. 在C和C ++中,名称以下划线开头,后跟一个大写字母(例如_M
)保留给语言实现。 They could be #define
d macros or names used for internal language implementation classes and functions. 它们可以是#define
d宏或用于内部语言实现类和函数的名称。 Therefore, you're not supposed to use them in your own code, since otherwise you might run into bizarre issues. 因此,您不应在自己的代码中使用它们,否则可能会遇到奇怪的问题。 I suspect that that's the issue here. 我怀疑这就是这里的问题。
Try renaming your variable to either use a lower-case m
or by dropping the underscore. 尝试重命名变量以使用小写的m
或删除下划线。 (As a heads-up, the same rule applies to names starting with two underscores, so don't try adding another underscore on the front. ^_^) (要注意,相同的规则适用于以两个下划线开头的名称,因此请勿尝试在前面添加另一个下划线。^ _ ^)
Hope this helps! 希望这可以帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.