I haven't found any extension, or tutorial to make and execute a C console application in the VSCode Terminal.
A simple program like
int main()
{
printf("Hello World!");
return 0;
}
And have the output in the VSCode Terminal.
Does someone know how to realize this? And/or are there solutions?
Thanks in advance
Regards
CodePudding user response:
There actually is an extension for c/c on VSCode: When you click the arrow in the top right (to run the file) you will be asked which compiler you want to use. In our case we can use the gcc compiler:
Then you can paste your code into a .c
file and run it with the compiler. It should automatically also execute the binary and print your output into the debug-console:
#include <stdio.h>
int main() {
printf("Hello World!");
return 0;
}
Hello World!
You even have a debugger, if you set certain breakpoints!
Extra: Make sure that you have the correct OS set in the bottom right (in the status bar), so your c code compiles for your machine specifically.