任何人都知道为什么在我的Visual Studio 2012 c ++项目中__cplusplus定义为199711L(这是"旧的"C++)?不应该说,201103L因为VS 2012现在有C++ 11支持吗?即使我包含C++ 11标头,它仍然是错误定义的.有线索吗?
我目前正在使用2017年的Visual Studio社区.通过查看项目属性中的C++语言标准,他们只提供C++ 14和C++ 17.由于我的代码是使用C++ 11的编译器完成以前的赋值,因此无法使用stoi等函数运行我的代码.我的问题是,是否有办法将C++ 11添加到C++的语言标准中?
我正在为GUI创建一个DLL,我的初始化是:
#include <string>
#include "stdafx.h"
using namespace std;
Run Code Online (Sandbox Code Playgroud)
这里我创建了一个分数类,ifstream中的主要错误如下:
istream& operator>>(istream& in, Fraction& f) {
string number;
in >> number; //read the number
size_t delimiter = number.find("/"); //find the delimiter in the string "/"
if (delimiter != string::npos) { //if delimiter is not empty
int n = stoi(number.substr(0, delimiter)); //set numerator from string to integer before the "/"
int d = stoi(number.substr(delimiter + 1)); //set denominator from string to integer after the "/"
if …Run Code Online (Sandbox Code Playgroud)