问题描述
大家好!
我最近从Qt-Creator切换到了NetBeans,对此决定我感到遗憾,这是我最近遇到的(很多)编译器错误等问题.
问题:
由于std::to_string
方法出现不合理的错误而安装了MinGW64编译器后,我遇到了类似的问题.
After installing the MinGW64 compiler due to an unreasonable error I had with the std::to_string
method, I have a similar issue.
当前,我正在使用MinGW64编译器,并且在尝试使用c_str()
函数时,出现错误
Currently, I am using the MinGW64 compiler, and when attempting to use the c_str()
function, I get an error
修复项目无效. 尝试使用自动完成功能不会提供任何建议
裸机最低代码:
#include <string>
using namespace std;
netm::netm(string hostname, int portNumber)
{
const char * c = hostname.c_str();
}
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)
有什么建议吗?
推荐答案
我通过 https://stackoverflow找到了解决此问题的方法.com/a/35025731/4101876
您需要设置以下内容:右键单击项目,选择属性.在Build-> C ++ Compiler下,将C ++ Standard设置为默认值以外的其他值.这将消除此错误.
You need to set the following: Right click on project, select properties. Under Build -> C++ Compiler, set C++ Standard to something other than default. This will remove this erroneous error.
这篇关于netbeans无法解析标识符c_str的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!