相关疑难解决方法(0)

Visual Studio 2012 __cplusplus和C++ 11

任何人都知道为什么在我的Visual Studio 2012 c ++项目中__cplusplus定义为199711L(这是"旧的"C++)?不应该说,201103L因为VS 2012现在有C++ 11支持吗?即使我包含C++ 11标头,它仍然是错误定义的.有线索吗?

c++ visual-studio visual-c++ c++11

18
推荐指数
4
解决办法
1万
查看次数

Visual Studio 2017中是否提供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)

c++ c++11 visual-studio-2017

13
推荐指数
1
解决办法
2万
查看次数