Coder Social home page Coder Social logo

ullaskunder3 / cpp-setup-vscode Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 2 KB

Setting up c/c++ in vs code (visual studio code). Vs code is one the best editor because of it's light weight, user friendly UI and robust features, development operations like debugging, task running, and version control... just awesome

Home Page: https://github.com/ullaskunder3/cpp-setup-vsCode/

cpp vscode configuration mingw mingw-w64 tdm

cpp-setup-vscode's Introduction

C/C++ setup for vs code

Author

Table Of Content

General info

what is a workspace ?

A Visual Studio Code workspace is the collection of one or more folders that are opened in a VS Code window (instance)

The best part: The concept of a workspace enables VS Code to: Configure settings that only apply to a specific folder or folders but not others.

The code . command opens VS Code in the current working folder, which becomes your workspace.

In a workspace:

settings as well as debugging and task configurations are stored at the root in a .vscode folder with file c_cpp_properties.json, task.json, launch.json.

You can even create it using Command Palette key combination Ctrl+Shift+P

SetUp

  1. Install MinGW or MinGW-w64 or TDM gcc

    inshort:

    Now the difference between MinGW, MinGW-w64, TDM GCC

    • MingGW is only for 32 bit-program
      !which can be run on 64 bit as well (not all(there are tricks as well))

    • MinGW-w64 is a newer which has the ability to support 32 & 64 bit

    • The MinGW distribution also doesn't use posix emulation to access threads in Windows (unlike MinGW-w64 or TDM64)

    • The TDM-gcc compiler also seems to implement the latest gcc version faster than the other projects.

    Its totally up to you according to your project

    • If you want to use the older graphics.h then go for MingW

    • If your working with something like SFML or SDL( Go for TDM GCC ) & OPENCV ( Go for MinGW-w64 )

      Set environemnt variable
      Search for Edit environment variables.
      In User variable click on Path & New path of compiler bin folder.
      select OK and save and exit

      Check from the terminal by the command

          g++ --version
          or
          gcc -v
  2. Install C/C++ extension for VS Code from vs code extension tab or key Ctrl+Shift+X

    • Now Configure environemnt by command pallet CTRL+Shift+P type >c/c++: Edit Configurations (JSON) this will generate c_cpp_properties.json file

    • For task.json same in the command pallet type >tasks: Configure Task then select the task g++ for cpp file this will generate task.json file

  3. That's it... Now create main.cpp in workspace

        #include <iostream>
        using namespace std;
        int main(){
            cout<<"Hola Amigooo";
            return 0;
        }   
    • After that to create executable or to run the program just use the key command Ctrl+Shift+B eso está todo hecho means that's all... done
  4. You can take it to the next level by modifying task.json

    • You can give the arguments
    • Specify where to build the .exe
    • ...

cpp-setup-vscode's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.