Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to compile vscode with the 17th version of Clippers

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report