member function redeclaration not allowed 问题

本文探讨了在C++编程中遇到的成员函数重复声明错误,并详细解释了导致这一问题的原因,即类内外声明不一致的情况,特别是对于静态变量的处理。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

'CButton CQQCDlg::buLogOn' : member function redeclaration not allowed

 

出现这种问题,一般是因为声明和定义的类型不一致。这里主要讲的不是数据类型不一致,而是修饰数据的类型不一致

 

比如在类中声明 CButton buLogOn

 

但在类外想定义为静态变量 CButton CQQCDlg::buLogOn 此时就出现标题上所示的报错了。

35 0 F:\Dev-Cpp\MinGW64\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++\random In file included from F:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/random 4 C:\Users\余伟杰\Desktop\RSA.cpp from C:\Users\余伟杰\Desktop\RSA.cpp 32 2 F:\Dev-Cpp\MinGW64\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++\bits\c++0x_warning.h [Error] #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options. C:\Users\余伟杰\Desktop\RSA.cpp In function 'bool isPrime(long long int, int)': 33 5 C:\Users\余伟杰\Desktop\RSA.cpp [Error] 'random_device' was not declared in this scope 34 5 C:\Users\余伟杰\Desktop\RSA.cpp [Error] 'mt19937' was not declared in this scope 35 5 C:\Users\余伟杰\Desktop\RSA.cpp [Error] 'uniform_int_distribution' was not declared in this scope 35 30 C:\Users\余伟杰\Desktop\RSA.cpp [Error] expected primary-expression before 'long' 38 27 C:\Users\余伟杰\Desktop\RSA.cpp [Error] 'gen' was not declared in this scope 38 30 C:\Users\余伟杰\Desktop\RSA.cpp [Error] 'dis' was not declared in this scope C:\Users\余伟杰\Desktop\RSA.cpp In function 'long long int generateLargePrime(int)': 59 5 C:\Users\余伟杰\Desktop\RSA.cpp [Error] 'random_device' was not declared in this scope 60 5 C:\Users\余伟杰\Desktop\RSA.cpp [Error] 'mt19937' was not declared in this scope 61 5 C:\Users\余伟杰\Desktop\RSA.cpp [Error] 'uniform_int_distribution' was not declared in this scope 61 30 C:\Users\余伟杰\Desktop\RSA.cpp [Error] expected primary-expression before 'long' 65 21 C:\Users\余伟杰\Desktop\RSA.cpp [Error] 'gen' was not declared in this scope 65 24 C:\Users\余伟杰\Desktop\RSA.cpp [Error] 'dis' was not declared in this scope C:\Users\余伟杰\Desktop\RSA.cpp In function 'void generateRSAKeys(RSAKey&, RSAKey&, int)': 103 22 C:\Users\余伟杰\Desktop\RSA.cpp [Error] 'gcd' was not declared in this scope 108 22 C:\Users\余伟杰\Desktop\RSA.cpp [Warning] extended initializer lists only available with -std=c++11 or -std=gnu++11 108 15 C:\Users\余伟杰\Desktop\RSA.cpp [Warning] extended initializer lists only available with -std=c++11 or -std=gnu++11 109 23 C:\Users\余伟杰\Desktop\RSA.cpp [Warning] extended initializer lists only available with -std=c++11 or -std=gnu++11 109 16 C:\Users\余伟杰\Desktop\RSA.cpp [Warning] extended initializer lists only available with -std=c++11 or -std=gnu++11 C:\Users\余伟杰\Desktop\RSA.cpp In function 'std::vector<long long int> rsaEncrypt(const string&, const RSAKey&)': 115 19 C:\Users\余伟杰\Desktop\RSA.cpp [Error] range-based 'for' loops are not allowed in C++98 mode 117 19 C:\Users\余伟杰\Desktop\RSA.cpp [Error] redeclaration of 'long long int c' 115 15 C:\Users\余伟杰\Desktop\RSA.cpp [Note] 'char c' previously declared here C:\Users\余伟杰\Desktop\RSA.cpp In function 'std::string rsaDecrypt(const std::vector<long long int>&, const RSAKey&)': 126 24 C:\Users\余伟杰\Desktop\RSA.cpp [Error] range-based 'for' loops are not allowed in C++98 mode C:\Users\余伟杰\Desktop\RSA.cpp In function 'int main()': 147 24 C:\Users\余伟杰\Desktop\RSA.cpp [Error] range-based 'for' loops are not allowed in C++98 mode
最新发布
07-07
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值