I recently found that my preinstalled Clang compiler on Macbook is very old which supports only C+98 standard.
So, while running any valid program of C++11, you must ensure that you run with -std=c++11.
Here is a problem which I encountered.
clang++ -std=c++11 -stdlib=libc++ main.cpp -o main
or
g++ main.cpp -std=c++11 -o main
Note: If you compile as "cc -std=c++17 -o main main.cpp", you will get errors.
Other errors I got in MacOS are below
Error: non-aggregate type 'vector<int>' cannot be initialized with an initializer list
References:
https://clang.llvm.org/cxx_status.html
Comments
Post a Comment