C++ 在Netbeans中使用std::next()
我在Visual Studio 2012中用C++编写了JSON转换器,我在程序中使用了STD:NEX:()。我们的教授希望我们使用Netbeans来提交程序,但我把代码带到了Netbeans中,现在我使用的std::next的所有地方都加了下划线,我的代码无法编译。下面是一个我遇到错误的例子。有人知道解决方法吗?提前谢谢C++ 在Netbeans中使用std::next(),c++,c++11,visual-studio-2012,netbeans,C++,C++11,Visual Studio 2012,Netbeans,我在Visual Studio 2012中用C++编写了JSON转换器,我在程序中使用了STD:NEX:()。我们的教授希望我们使用Netbeans来提交程序,但我把代码带到了Netbeans中,现在我使用的std::next的所有地方都加了下划线,我的代码无法编译。下面是一个我遇到错误的例子。有人知道解决方法吗?提前谢谢 void element::printAttributesToFile(ofstream& outFile) { map<string, string&
void element::printAttributesToFile(ofstream& outFile)
{
map<string, string>::iterator it; //for iterating through the map of attributes and values
if(attributes.size()>1) //if there are more than one attribute, make an array
{
outFile << "[" << endl;
}
for(it=attributes.begin(); it != attributes.end(); ++it) // iterates through the map
{
outFile << "{" << endl; //brackets surrounding ever attribute
outFile<<"\""<<it->first<<"\": "<< "\""<< it->second<<","<<endl;
if(!content.empty()){ // if there is content, print it
outFile<<"\"content\": "<< "\""<< content << "\"" <<endl;
}
outFile << "}" << endl;
if(next(it) != attributes.end()) //is this the last attribute
{
outFile << "," << endl; //if not, print the comma
}else if(next(it)==attributes.end()){ //if it is
outFile << endl; //print a new line
}
}
if(attributes.size()>1) //closing the array
{
outFile << "]" << endl;
}
//outFile<<"]"<<endl;
}
void元素::printAttributesToFile(流和输出文件)
{
map::iterator it;//用于遍历属性和值的映射
if(attributes.size()>1)//如果有多个属性,则创建一个数组
{
outFile是否包含头文件?编译器有时只知道头文件存在,而其他编译器不存在。您需要转到编译器配置,确保它说明使用C++11(或更好)标准。(GCC默认为C++98。)解决您的问题?是否包括头文件?编译器有时只知道头文件存在,而其他编译器不知道。您需要转到编译器配置,确保它说明使用C++11(或更好)标准。(GCC默认为C++98。)解决您的问题?