Home > OS >  How to run C program from terminal VS Code
How to run C program from terminal VS Code

Time:09-10

I want to run a C program in VS Code. All I get from Google is that click on run and debug (the play button) on top right in VS Code and my program will be up and running. I don't want to do from that. I want to do it from terminal.

Example, to run:

  1. A Python file I do: python3 fileName.py
  2. A Flutter program: flutter run
  3. A Java file: javac fileName.java
  4. A Go file: go run fileName.go

Is there any command similar like this in C ?

Apologies, I know my question is a little naïve.

CodePudding user response:

i guess the short answer would be :

$ g -o < name-you-want-to-give> source.cpp

In place of replace it by any name like myprogram, etc. ./myprogram

This mean you had to install gcc compiler beforehand.

CodePudding user response:

I need to be in my project directory and then i need to run

g   01inputFromUser.cpp -o 01inputFromUser && "/home/aman/Desktop/arjun/cpp/"01inputFromUser

so this was what I was looking for

g   fileName.cpp -o fileName && "/path/to/project/"fileName
  • Related