nonstandard extension used enum used in qualified name 问题解决方法
2013-12-05 10:38
369 查看
当在工程中,使用枚举变量时,若采用 MenuType::menuItem, 会出现warning
warning:nonstandard extension used enum used in qualified name
这是因为在C++中,类和枚举变量在调用时还是有区别的,所以直接采用 menuItem,而不是MenuType::menuItem方式调用,就可以消除这个warning。
例如:
将以上代码红色部分改为
cout << first <<endl; 即可消除warning
warning:nonstandard extension used enum used in qualified name
这是因为在C++中,类和枚举变量在调用时还是有区别的,所以直接采用 menuItem,而不是MenuType::menuItem方式调用,就可以消除这个warning。
例如:
#include <iostream> using namespace std; int main(){ enum test{first=100,second,third} ; cout << test::first <<endl; return 0; }
将以上代码红色部分改为
cout << first <<endl; 即可消除warning
相关文章推荐
- 【IDE-Visual Studio】warning C4482: nonstandard extension used: enum 'x' used in qualified name
- warning:nonstandard extension used enum
- Error creating bean with name ‘…’defined in class path resource[applicationContext2.xml]:问题及其解决方法
- C++ 使用#define带来的问题及解决方法(const enum inline)
- You cannot run the non-logged version of bulk copy in this database. Please check with the DBO. 问题的解决方法
- You cannot run the non-logged version of bulk copy in this database问题的解决方法
- centos username is not in the sudoers file 问题解决方法
- Mysql解决SELECT list is not in GROUP BY clause and contains nonaggregated column 问题
- NO Cortex-M Device found in JTAG chain常见问题及解决方法.
- 关于IE中getElementsByClassName不能用的问题解决方法
- 开发新浪微博应用出现以下问题Fatal error:Call to undefined function curl_init() in错误的解决方法
- 解决CentOS-HTTP出现“httpd: Could not reliably determine the server's fully qualified domain name”问题
- rattle安装gtk_buildable_get_name问题解决方法
- exception in thread main java.lang.NoClassDefFoundError wrong name解决方法
- 安装JDK时提示 IllegalArgumentException:Invalid characters in hostname的解决方法
- 方法:如何解决NetShareEnum返回ERROR_NO_UNICODE_TRANSLATION(1113)的问题
- The remote name could not be resolved问题的解决方法
- apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName错误的解决方法
- psql: FATAL: the database system is in recovery mode - 问题定位方法与解决
- Xcode4 attaching to appname问题解决方法