[英]netbeans unable to resolve identifier c_str
Good day all 美好的一天
I have recently switched from Qt-Creator to NetBeans, and I am regretting this decision, this is the latest (of many) issues I have had with compiler error, etc. 我最近从Qt-Creator切换到了NetBeans,我对这个决定感到后悔,这是我在编译器错误等方面遇到的最新(很多)问题。
Previous issue and MinGW64 compiler installation 上一期和MinGW64编译器安装
Problem: 问题:
After installing the MinGW64 compiler due to an unreasonable error I had with the std::to_string
method, I have a similar issue. 由于我使用
std::to_string
方法的不合理错误安装MinGW64编译器后,我遇到了类似的问题。
Currently, I am using the MinGW64 compiler, and when attempting to use the c_str()
function, I get an error 目前,我正在使用MinGW64编译器,并且在尝试使用
c_str()
函数时,我收到错误
unable to resolve identifier c_str
无法解析标识符c_str
Reparsing the project has no effect. 重新调整项目无效。 Attempting to use auto-complete provides no suggestions aswel
尝试使用自动完成功能不会提供任何建议
Bare Minimum Code: 裸露最低代码:
#include <string>
using namespace std;
netm::netm(string hostname, int portNumber)
{
const char * c = hostname.c_str();
}
Netbeans IDE Info: Netbeans IDE信息:
Product Version: NetBeans IDE 8.2 (Build 201609300101)
Java: 1.8.0_112; Java HotSpot(TM) 64-Bit Server VM 25.112-b15
Runtime: Java(TM) SE Runtime Environment 1.8.0_112-b15
System: Windows 10 version 10.0 running on amd64; Cp1252; en_ZA (nb)
Any suggestions? 有什么建议?
I found the solution to this problem through https://stackoverflow.com/a/35025731/4101876 我通过https://stackoverflow.com/a/35025731/4101876找到了解决这个问题的方法
You need to set the following: Right click on project, select properties. 您需要设置以下内容:右键单击项目,选择属性。 Under Build -> C++ Compiler, set C++ Standard to something other than default.
在Build - > C ++ Compiler下,将C ++ Standard设置为默认值以外的值。 This will remove this erroneous error.
这将消除这个错误的错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.