lundi 13 mars 2023

How can I figure out this warning about C++11 extensions [-Wc++11-extensions]? [duplicate]

I was following a C++ course video on YouTube about typedef. Instead of typedef, the instructor recommended to use using, but when I run the code I get a warning:

alias declarations are a C++11 extension [-Wc++11-extensions]

How do I remove this warning?

The code was like this:

#include <iostream>
#include <vector>
/*
typedef std::vector<std::pair<std::string, int>> pairlist_t;

int main()
{
   //std::vector<std::pair<std::string,int>> pairlist;
     pairlist_t pairlist;
     return 0;
}
*/
//typedef std::string text_t;
//typedef int number_t;
using text_t = std::string;
using number_t = int;
int main()
{
    //std::string firstName;
    text_t firstName = "Lee";
    number_t age = 21;
    std::cout << firstName << '\n';
    std::cout <<age << '\n';

}

Aucun commentaire:

Enregistrer un commentaire