简体   繁体   中英

Trouble running a simple "Hello world" using Visual Studio code

I've recently started to learn C++ however I can't even get a simple program to even run . I am using Visual Studio Code and I used this tutorial https://code.visualstudio.com/docs/cpp/config-mingw to set up C++. I followed every step and have not gotten any errors even until this point. Whenever I try to run helloworld.exe from the terminal in Visual Studio Code, nothing happens, not even any errors show up. Please help!

(Side question: Every time I want to run an updated version of my code, do I have to build it before running it using Ctrl+Shift+B? Also, do you have to run code through the terminal? Is there no easy to press run button or shortcut like in PyCharm for Python to run code?) 在此处输入图像描述

Here is a picture of my tasks.json: 在此处输入图像描述

My suggestion is that you open the terminal and go to your folder using cd and the folder name, and compile the file with:

g++ filename.cpp

and run it with:

./a.out

For Unix systems for windows I think it is:

./a.exe

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM