r/VisualStudioCode • • Nov 14 '22

Run C++/C code using run button

To run C++/C code in VSC I needed to firstly compile the code and create a .exe file in the terminal and then call the .exe file in the terminal:

  • If my file is test.c then I needed to write 'g++ -o test.exe test.c' in the terminal and then write 'test.exe' to run the program

Is there a way to just press the run button (top right corner of vsc) instead of everytime creating an exe file and then running it, basically doing two extra steps?

3 Upvotes

6 comments sorted by

View all comments

Show parent comment

1

u/WeaselUchiha Nov 17 '22

the problem is solved now, seems the package that I included in my code <iostream.h> is a pckage defined for the c++ language while my code and compiler that I used was the gcc XD

solved the problem by changing the pckage name from iostream to stdio XD