I am a beginner in c++ and every time I run vector<int> nums = {2, 5, 3, 7, 1};
it gives me the Error: non-arregrate type vector cannot be initialized with initializer list.
Can you tell me why?
Thanks,
I am a beginner in c++ and every time I run vector<int> nums = {2, 5, 3, 7, 1};
it gives me the Error: non-arregrate type vector cannot be initialized with initializer list.
Can you tell me why?
Thanks,
Using Druhv Sehgal's answer above, this worked for me on mac
If command not found: gcc++
try
clang++ -std=c++11 <filename>
If you are using VS code, then go to settings.json, Add "-std=c++17", "-stdlib=libc++" in the args array.
© 2022 - 2024 — McMap. All rights reserved.
-std=c++11
. – Odontographg++ -std=c++11 prog.cpp
. – Odontograph