vector initialization error cannot be initialized with an initializer list

This problem is mainly caused by the different versions of the C++ compiler. You can refer to the vector error report , and you need to specify the C++ version when compiling.

If you use vscode as the editor and use the code runner plugin, you can modify the configuration of the plugin "Executor Map".

insert image description here
The cpp line is changed to:

# -std用于指定C++编译器版本
"cpp": "cd $dir && g++ $fileName -o $fileNameWithoutExt -std=c++11 && $dir$fileNameWithoutExt"

Of course, you can also execute g++ commands directly on the command line.

Guess you like

Origin blog.csdn.net/u012949658/article/details/112465359