r/learnprogramming • u/Tampoi_ • Oct 06 '26
How to set up an C++ project?
Like i understand you go on Visual Studio Code and just create some files like main.cpp and stuff but what are these like settings.json and other .json files. Its actually really confusing seeing a .json file in what supposed to be a c++ project. Whole explorer layout is confusing to me i don't understand how to write it there is no tutorials for it too like its just confusing
3
Upvotes
7
u/xarop_pa_toss Oct 06 '26 edited Oct 06 '26
That's VSCode configuration files. C++ itself doesn't need any of that.
All you need is a .cpp file and a compiler like g++. I recommend you just use the terminal to start with (you can use the one inside VSC) and compile and run your programs with the terminal commands. You don't have to become a compiler wizard but knowing the basics of it is very valuable.
Remember that you don't even need VSCode for any of this. You can literally use only terminal based text editors and commands to program C++ (and a lot of other languages)
6
u/THAErAsEr Oct 06 '26
Google would have answered this faster than reddit. If you want to learn to program in any language, you have to use google
1
u/kutac56 Oct 06 '26
That's only vs code stuff. Doesn't have anything to do with c++. There are other ways to write code than vs code
1
u/Jazzlike_Platypus430 Oct 06 '26
launch.json and tasks.json is the way. It is confusing at first.
1
u/nelson_fretty Oct 06 '26
Use cmake file
1
u/burlingk Oct 06 '26
So, C++ has yet basic file types . .cpp and .hpp.
Everything else is either created by the IDE/build system, or is project specific.
The project specific stuff will come about organically as you realize you need it.
1
u/[deleted] Oct 06 '26
You didn’t Google what a settings.json file is?
1
u/goldscurvy Oct 06 '26
I think the minimum for a cpp project would be a folder to hold the files. This isnt Java, where there is an expectation that specific packages follow a certain directory structure.
There are common "conventions" for project organization. Like it is common to have at least a src subfolder. It is also common to separate src to src, include, and test. There are other ways people will organize stuff. Sometimes they will group related functionality together.
But all you really need for a project are source files. cmake also wants its cmake file. Make will want makefiles.
Settings.json is a vscode thing. It tells vscode about settings specific to that project. I use jetbrains IDEs, and that has the convention of a .idea folder where any specific settings or Metadata ate kept.