如图所示,这样的代码为什么会显示找不到标识符错误,在dc下可以编译通过
#include "stdafx.h"
#include"iostream"
using namespace std;
int main()
{
int sum = 0;
int i;
cout << "输入一串数字或者空格" << endl;
while (cin >> i) {
sum += i;
while (cin.peek() == ' ') {
cin.get();
}
if (cin.peek() == '\n') {
break;
}
}
cout << sum << endl;
return 0;
}
代码没问题,应该是哪里的设置问题
I had exactly the same problem with __builtin_addressof and I solved it.
1.Open the About in the Visual Studio 2015.
2.If there is an Update 3, close the Visual Studio 2015.
3.Open the Programs and Features in the Control Panel.
4.Right click on your Microsoft Visual Studio ... 2015 in the list and choose Change.
5.In the wizard choose Repair and continue... (It is long-running operation, I have SSD and i5 and it took several hours.)
#include"iostream"
->
#include <iostream>