Skip to content

oscardelgado02/CPP-Solution-For-Visual-Studio-Code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C++ Solution For Visual Studio Code

A working solution for Visual Studio Code to start programming in C++.


How to use

Compiler

First of all, you will need to change the path of the compiler you are going to use inside .vscode/tasks.json file:

{
   "tasks": [
       {
           ...
           "command": "E:\\MinGW\\bin\\g++.exe",
           ...
       }
   ]
}

In my case, I installed and used MinGW G++ compiler.

Add a class to the project

To add a class, you need to create two files and add them on src folder:

  • className.cpp
  • className.h

Also, you will need to add the class cpp path inside .vscode/tasks.json file:

{
   "tasks": [
       {
           ...
           "args": [
               "-fdiagnostics-color=always",
               "-g",
               "${workspaceFolder}\\src\\main.cpp",
               "${workspaceFolder}\\src\\className.cpp", //your class path here

               // you can add more classes here

               "-o",
               "${workspaceFolder}\\program.exe"
           ],
           ...
       }
   ]
}

Compile and run the program

Compile src/main.cpp and program.exe file will be generated. Just run program.exe and you will be running the program you have just created!

Releases

No releases published

Packages

No packages published

Languages