Get the App
SLTechnology News&Howtos  ›  Development  › 

How to compile vscode with the 17th version of Clippers

Shulou Source: shulou.com Published: 2022-06-02 01:12:47 09月12日 Update

This article mainly introduces how vscode is compiled with the 17th version of Clippers, which has a certain reference value. Interested friends can refer to it. I hope you can learn a lot after reading this article. Let's take you to know it.

One day when I was doing some exercises, I used this method to initialize a vector.

Vector nums = {- 4 meme 1 meme 0pr 3 pr 10}

The compiler quickly executed the compile command.

If ($?) {if + day2_1.cpp-o day2_1}; if ($?) {.\ day2_1}

And also quickly reported the wrong (mailed)

Day2_1.cpp: In function 'int main ()': day2_1.cpp:17:37: error: in Clippers 98 'nums' must be initialized by constructor, not by' {...} 'vector nums = {- 4 Ling Ling 1 Ling 0 Jing 3 10}

Obviously, this is because the C++ version of my compilation command does not support this way of vector initialization.

So we need to modify the compilation options.

But vscode this advanced notepad is quite troublesome to modify, so record it here.

Code Runner

In vscode, I usually use the codeRunner plug-in to compile and run the code, so my modified version here is modified on Code Runner

We go directly to vscode, under our .vsode folder, modify the setting.json file, and add a setting

"code-runner.executorMap": {"cpp": "cd $dir & & Gmail +-std=c++17$ fileName-o $fileNameWithoutExt & & $dir$fileNameWithoutExt",}

After the changes are saved, we compile the file again, and we can see that the compile command on the command line looks like this

If ($?) {if +-std=c++17 day2_1.cpp-o day2_1}; if ($?) {.\ day2_1}

Good, so that our code can compile and run correctly

No need for Code Runner

Some hxd do not like to use Code Runner, that is fine, just use it in the tasks.json file under .vscode and set the compilation options.

My tasks.json looks like this.

{"version": "2.0.0", "tasks": [{"type": "shell", "label": "task gaming +", / / modify this item / / "command": "D:\\ 2Software\\ mingw64\\ bin\ g++.exe", "command": "C:\ Mingw64\\ mingw64\\ bin\\ g++.exe" "args": ["- g", "${file}", "- o", "${fileDirname}\\ ${fileBasenameNoExtension} .exe", "- std=c++17"], "options": {"cwd": "C:\\ Mingw64\\ mingw64\\ bin"} "problemMatcher": ["$gcc"], "group": "build"} Thank you for reading this article carefully I hope the article "how to compile vscode with Clipper 17 version" shared by the editor will be helpful to you. At the same time, I hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Tags: Compile version command file article code quick way support run obvious advanced not used value interest again at the same time plug-ins folders time Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Huawei MySQL Shulou Tech Info MariaDB