This is a guide for creating, building and running a C/C++ project with multiple files, libraries and configurations, in VSCode. During my university

Setup Guide for C/C++ Programming on VSCode

submited by
Style Pass
2024-09-20 14:00:13

This is a guide for creating, building and running a C/C++ project with multiple files, libraries and configurations, in VSCode.

During my university days and even after graduation, the process of creating a C or C++ application from the scratch was unclear to me.

Until about 2 years into my career, the only way I knew how to create C and C++ applications was to fire up VSCode, make a new main.c or .cpp and hope that VSCode is able to generate the missing files required to compile, run and debug it. Sometimes it did.

But most of the times it would show some error that some file or configuration is missing, after which I would have to resort to Eclipse and its behind the scenes magic for creating, building and running my applications.

For students such as myself, that are studying something like mechatronics engineering and not computer science, we aren’t taught what happens under the “build” or “compile” buttons in our IDEs. And so I have put up this guide, for students and beginners that want to know how to compile their C and C++ codes.

To compile or build your program, you need a C compiler. Which can be GCC. And to debug it, you’d need a debugger. Which can be GDB. There are other compilers and debuggers but I find it easier to use just these two.

Leave a Comment