【发布时间】:2015-08-21 12:10:10
【问题描述】:
我使用的是 VS2008 和 Win7 64bit。
#include <iostream>
#include "utils.h"
#include <string>
int main()
{
int gm = DETECT;
int gd = DETECT;
initgraph(&gm, &gd, "");
double x = 0;
double y = 0;
double r = 50;
for(int i=0 ; i<=360 ; i++)
{
x = r * cos(DegreeToRad((double)i));
y = r * sin(DegreeToRad((double)i));
PlotLine(0,0,x,y, YELLOW);
std::string str;
str.append(std::to_string(i));
str.append(". ");
str.append(std::to_string(0));
str.append(", ");
str.append(std::to_string(0));
str.append(") to (");
str.append(std::to_string(x));
str.append(", ");
str.append(std::to_string(y));
str.append("). m=");
str.append(std::to_string(Slope(0,0,x,y)));
str.append("\n");
if(i%90==0)
{
str.append("\ni=");
str.append(std::to_string(i));
str.append("\n");
}
WriteToFile("slope.txt", str.c_str());
}
getch();
closegraph();
return 0;
}
错误消息。
1>e:\slope.test.cpp(21) : error C2039: 'to_string' : is not a member of 'std'
1>e:\slope.test.cpp(21) : error C3861: 'to_string': identifier not found
1>e:\slope.test.cpp(23) : error C2039: 'to_string' : is not a member of 'std'
1>e:\slope.test.cpp(23) : error C3861: 'to_string': identifier not found
1>e:\slope.test.cpp(25) : error C2039: 'to_string' : is not a member of 'std'
1>e:\slope.test.cpp(25) : error C3861: 'to_string': identifier not found
1>e:\slope.test.cpp(27) : error C2039: 'to_string' : is not a member of 'std'
1>e:\slope.test.cpp(27) : error C3861: 'to_string': identifier not found
1>e:\slope.test.cpp(29) : error C2039: 'to_string' : is not a member of 'std'
1>e:\slope.test.cpp(29) : error C3861: 'to_string': identifier not found
1>e:\slope.test.cpp(31) : error C2039: 'to_string' : is not a member of 'std'
1>e:\slope.test.cpp(31) : error C3861: 'to_string': identifier not found
1>e:\slope.test.cpp(37) : error C2039: 'to_string' : is not a member of 'std'
1>e:\slope.test.cpp(37) : error C3861: 'to_string': identifier not found
1>Generating Code...
1>Build log was saved at "file://e:\Debug\BuildLog.htm"
1>RasterizationLineCircleEllipse - 15 error(s), 14 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
【问题讨论】:
-
那个版本支持c++11吗?
-
Visual Studio 2008 不支持 C+11,考虑到它已于 2008 年发布,这会很奇怪。
-
哦,在下一个问题之前,请参阅stackoverflow.com/questions/20302891/…
-
对于您似乎需要查看代码的内容(将各种数据连接到字符串中),请使用
std::ostringstream。
标签: c++ compiler-errors bgi