[英]How to compile and run cpp file using g++ in Visual Studio Code?
I'm trying to use a task, but could only find how to compile: 我正在尝试使用任务,但只能找到如何编译:
{
"version": "0.1.0",
"command": "g++",
"args": ["-Wall", "${file}"],
"showOutput": "always"
}
I'd also like to print input/output to console when the program is running. 我还想在程序运行时将输入/输出打印到控制台。
You might want to have a look at https://code.visualstudio.com/Docs/tasks 您可能想看看https://code.visualstudio.com/Docs/tasks
At the end there is an example how to setup the task system to use gcc. 最后有一个示例,说明如何设置任务系统以使用gcc。 If you have more than a handful files to compile you might want to think about using a make file and call make instead of gcc directly.
如果要编译的文件不只几个,则可能需要考虑使用make文件并直接调用make而不是gcc。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.