我试图创建一个使用Eclipse kepler IDE返回int指针值的函数,并在尝试构建它时遇到此错误。
c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support for the \
^
如何启用" -std = c ++ 11或-std = gnu ++ 11编译器选项。" ?
这是我的代码:
#include <iostream>
#include <array>
using namespace std;
int* maxVal (int num[], int numSize)
{
int *max;
max = &num[0];
for (int i=0; i<numSize; i++){
if (num[i] >= *max)
max = &num[i];
}
return max;
}
int main() {
int num[] = {23, 45, 67, 8};
cout << maxVal(num, sizeof(num));
return 0;
}
我真的不知道出现了什么错误/是否存在语法错误? IDE没有这么说:/
提前感谢您的反馈。我真的很感激。