如何配置g++选项-std=c++11?
g++命令改为:
g++ -std=c++11
qt配置std的c++11
QMAKE_CXXFLAGS += -std=c++11
如果没有配置c++11,就会报如下错:
for(auto&y :edges[x]) {
if(belong[y]== -1) {
belong[y]=cntBelong;
Q.push(y);
}
}}异常:
/lbg/track/tld/tld_project/TLD.cpp:92: error: ISO C++ forbids declaration of 'y' with no type [-fpermissive]
for(auto &y : edges[x])
/lbg/track/tld/tld_project/TLD.cpp:93: error: range-based 'for' loops are not allowed in C++98 mode
for(auto &y : edges[x])