Skip to main content

Setting up Cpp environment on VS Code | Windows 10

I have recently switched to Windows 10 from PopOs ( a Debian-based Linux) because of my project-related work which could not be done in any Debian-based Linux. So, I installed windows 10 on my system and it was just a little annoying but cool as well because my system's performance has increased (which was obvious as I have deleted all my previous data just backed up around 60Gb of it).
So, starting with the process of setting up the environment for C++ on the VS Code on Windows 10. In Linux, I used to run C++ files on Sublime text only but on Windows, I'm just using VS code for both C++ and JavaScript.
Let's start setting up the environment. I am dividing this whole process into 4 steps:
  1. First, you have to set up a compiler for the system. As we know that C/C++ is compiled programming language which requires a compiler to make them compiled and run. In Linux, there is already a gcc/g++ compiler preinstalled. But in Windows, you have to install it separately. So you can download MinGW-w64 for windows 10 from here




  2. After installing the MinGW compiler, you have to set up the PATH variable for it.
    1. First, go to the Start button and search for setting and open that.
    2. Now search Edit environment variables for your account.
    3. Select Path and click the edit button.
    4. Now click new and add the path of the bin folder of mingw64.




  3. After adding the path variable, now open VS code (Download it from here if you have not installed it already). Then open a new CPP file in the window.
      1. Now, click on terminal and select Run Build Task or press Ctrl+Shift+B.
      2. Select C/C++: g++.exe build active file it will build the .exe file for your code.


  4. Now your C++ environment is set.
    Let's give it a try, go to your PowerShell and type ./{name_of_your_cpp_file}. Boom it's running.


For IntelliSense and debugging, use the C/C++ extension from Microsoft.



If you found any problem regarding setting up the environment, you can say it in the comments or reach via the given contact form.
Thanks

Comments

Popular posts from this blog

3 hacks to wake up early in the morning

So this is what everyone says that we have to wake up early in the morning. Yes, it's good to wake up early and this could be the best decision you will take in your life.   I have read this somewhere that " If you want to change your life, do nothing just start waking up early in the morning and things will start happening ". So yes waking up early in the morning is going to help you a lot and it will surely help in changing your life. Now the question that arises is how we can wake up early in the morning? We all want to wake up early at 5 or 6 Am in the morning but when the clock hits 5 and your alarm makes the sound, your mind says just 5 minutes more and these 5 minutes end up at 1 hour.  So the question is how can we make it to wake up early in the morning. So in this article, I'm sharing 3 hacks that can surely help you in achieving your goal of waking up early in the morning.  The secret of waking up early doesn't lie in the process of waking up early in

Flow Network | Ford-Fulkerson Algorithm

Flow Network is a directed graph in which each edge has a capacity and each edge receives a flow.  In this blog, we will discuss the following things: Introduction of:  network, max-flow problem capacity, flow Ford-Fulkerson method pseudo code, residual networks, augmenting paths cuts of networks Introduction -  Network We can understand Network by looking into some examples: liquids flowing in pipes, parts through assembly lines in a factory, the current through electrical network. Flow Network: Directed graph, G=(V, E)                              where V is set of vertices,                                            E is set of Edges. Max-Flow problem Max-flow problem is about finding the feasible flow through a flow network and with maximum possible flow rate. Capacity( of an edge ) Capacity is the maximum limit of flow that edge can allow. If (u,v) ∉ E ⇒ c(u,v) = 0 Flow It is the amount that is currently flowing now in an edge. Flow in G=(V, E) : f: VxV -> R with 3 properties:

Best Indian Technical Blog | TechGecs

There is no doubt about the fact that as time is changing day by day, technology is also changing at a very fast pace. Every day a new technology came into the picture that’s why this is going to be very urgent to be updated every second, and people from different places of the earth must keep hooked to it.    Although, there is a variety of tech influencers or tech bloggers in India that have expertise in their technical domain and they are really worthy to appreciate for their work, throughout the country. Technology has transformed our lives completely different from before. This niche is really has attracting nature across different spheres throughout the globe.  Well, if you came here while searching for the best Indian technical blog so, we have a deep discussion on the best tech blogs TechGecs , whose owner Ashish Pratap Singh updates his tech blog regularly. What makes the TechGecs outstanding in terms of performance and rank, is their approach and sense of understanding in t