提问者:小点点

为什么代码块显示错误?


代码:

#include<map>
#include<vector>
#include<iostream>

using namespace std; 

int main() 
{ 
    map<int, int> mp1, mp2; 
    mp1.insert({ 1, 2 }); 
    cout << "The max size of mp1 is " << mp1.max_size(); 
    cout << "\nThe max size of mp2 is " << mp2.max_size(); 
    return 0; 
}

对于上述错误,我正在更改codeblocks的设置。。。设置>GNU GCC compiler>compiler flags>have g++follow the c++11 ISO c++language standard[-std=C++11],但这次也显示了相同的错误。

我该怎么办??


共1个答案

匿名用户

#include<map>
#include<vector>
#include<iostream>

using namespace std; 

int main() 
{ 
    map<int, int> mp1, mp2; 
    mp1.insert({ 1, 2 }); 
    cout << "The max size of mp1 is " << mp1.max_size(); 
    cout << "\nThe max size of mp2 is " << mp2.max_size(); 
    return 0;

就是你所有的代码,如果是的话,你在末尾缺少了一个},你的解释器应该会给你一个错误。如果不是的话,请传递你代码的完整部分。

干杯