<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: snelzing</title>
    <description>The latest articles on DEV Community by snelzing (@snelzing).</description>
    <link>https://dev.to/snelzing</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F936615%2F676c3823-8959-47e5-b611-b9e5c0c8d0c2.png</url>
      <title>DEV Community: snelzing</title>
      <link>https://dev.to/snelzing</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/snelzing"/>
    <language>en</language>
    <item>
      <title>How to Run a Darn C++ File on Windows, Finally</title>
      <dc:creator>snelzing</dc:creator>
      <pubDate>Sun, 14 May 2023 21:36:40 +0000</pubDate>
      <link>https://dev.to/snelzing/how-to-run-a-darn-c-file-on-windows-finally-334b</link>
      <guid>https://dev.to/snelzing/how-to-run-a-darn-c-file-on-windows-finally-334b</guid>
      <description>&lt;p&gt;I made this because while there are a lot of tutorials to configure C++, and none of them worked straight through for me. So I wounded up having to combine info from different tutorials. So hence I made this one tutorial that will hopefully work all the way through. If not, let me know. &lt;/p&gt;

&lt;p&gt;There are a lot of ways - this is the way that worked for me:&lt;/p&gt;

&lt;p&gt;1) There are a lot of IDEs you could use - I'm gonna say use Vscode because that is probably the one you already have.&lt;/p&gt;

&lt;p&gt;2) Install these plugins - C/C++&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7nSBIQ8I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/95i4wz6juoqea8x9c5n7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7nSBIQ8I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/95i4wz6juoqea8x9c5n7.png" alt="Image description" width="800" height="290"&gt;&lt;/a&gt;&lt;br&gt;
and&lt;br&gt;
Code Runner&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--r98oV4Lk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9qg117cvlri7nqlcouhk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--r98oV4Lk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9qg117cvlri7nqlcouhk.png" alt="Image description" width="800" height="250"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I would let them install completely first before moving on to keep things simple.&lt;/p&gt;

&lt;p&gt;3) If you already have Visual Studio installed, you can use it to install C++. But if you don't or don't want to wait for the half hour it takes to open, instead go to &lt;a href="https://visualstudio.microsoft.com/downloads/#remote-tools-for-visual-studio-2022"&gt;https://visualstudio.microsoft.com/downloads/#remote-tools-for-visual-studio-2022&lt;/a&gt;&lt;br&gt;
and then download the build tools.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iUN7F1Up--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p0c5a1qkajhddm63iy9f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iUN7F1Up--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p0c5a1qkajhddm63iy9f.png" alt="Image description" width="800" height="106"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;4) Open that up, and install C++. It will take forever to download, but it still beats the alternatives I guess.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sJLmZGd9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x9b56rhyn9ylrcd14ai2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sJLmZGd9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x9b56rhyn9ylrcd14ai2.png" alt="Image description" width="800" height="397"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;5) Now this part is the part that took some work to figure out, so thank me later - open up Developer Command prompt for VS 2022:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--e1U1eSOx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i5anxitwg7cysd7axnvq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--e1U1eSOx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i5anxitwg7cysd7axnvq.png" alt="Image description" width="348" height="94"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;6) Type cl to make sure everything is kosher up to this point. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MmXD_cHt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ahmf07wk5o0psit4dvoz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MmXD_cHt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ahmf07wk5o0psit4dvoz.png" alt="Image description" width="800" height="456"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;7) Now create a hello world project to test your installation.&lt;br&gt;
In my case, it is just in a "~\devl\C++\helo_world" (I dare you to comment on the misspelling).&lt;/p&gt;

&lt;p&gt;8) Make a file with this basic program:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;iostream&amp;gt;
#include &amp;lt;vector&amp;gt;
#include &amp;lt;string&amp;gt;

using namespace std;

int main()
{
    vector&amp;lt;string&amp;gt; msg {"Hello", "C++", "World", "from", "VS Code", "and the C++ extension!"};

    for (const string&amp;amp; word : msg)
    {
        cout &amp;lt;&amp;lt; word &amp;lt;&amp;lt; " ";
    }
    cout &amp;lt;&amp;lt; endl;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;save it and close out of visual studio code - &lt;strong&gt;don't skip the closing out.&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;9) Go back to your Developer Command prompt for VS 2022 and navigate to the folder where your hello world project is. Type &lt;code&gt;code .&lt;/code&gt;. This will open it up in VScode.&lt;/p&gt;

&lt;p&gt;10) Click the Run button and it will ask you to configure it. Or, press the gears icon next to the run button and select this first option you see here (I'm not typing all that out):&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BkIObAEu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2vtk4jws1i4jacswmxwu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BkIObAEu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2vtk4jws1i4jacswmxwu.png" alt="Image description" width="800" height="184"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is the screen you want to get to - there are multiple ways to get here, and the ways seem to change frequently, but this is the&lt;br&gt;
destination. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--whNwHsP_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/esf30w75d0yifln9cmre.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--whNwHsP_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/esf30w75d0yifln9cmre.png" alt="Image description" width="800" height="455"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This screen is called "Edit configurations (UI)":&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BRm256hZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hrpd4b7jg8ghh296x04f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BRm256hZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hrpd4b7jg8ghh296x04f.png" alt="Image description" width="800" height="49"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;11) Hit the dropdown arrow - you will need to have it pre-filled. If you don't see anything something is wrong and you will need to retrace your steps. &lt;/p&gt;

&lt;p&gt;12) I selected one of the options that had &lt;code&gt;x64&lt;/code&gt;. I am not sure why there are four of them, and what they all mean to be honest. I just know I got it working. Get used to that in tech (especially with C++). &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fVHKrmNg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ydtqpzm72std2w2mpvvg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fVHKrmNg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ydtqpzm72std2w2mpvvg.png" alt="Image description" width="800" height="195"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;13) NOW you should be able to just run it. Because it is C++, it creates a whole flurry of files:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QxnDrxCS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u0e8q7wn7s5ry02k14lw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QxnDrxCS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u0e8q7wn7s5ry02k14lw.png" alt="Image description" width="800" height="455"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9Xh2XT_G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/njf6hurs2ntgu7txbnax.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9Xh2XT_G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/njf6hurs2ntgu7txbnax.png" alt="Image description" width="800" height="206"&gt;&lt;/a&gt;&lt;br&gt;
The .exe is the end goal. &lt;/p&gt;

&lt;p&gt;Bonus: If you were to run it again, it gives an error. I think it really is just confused because there is already an .exe. &lt;/p&gt;

&lt;p&gt;By the way, with the C++ code I gave you, if you run that .exe by just double-clicking on it, it will seem to do nothing. It is actually running, just very quickly. VScode adds the &lt;code&gt;Press any button to continue...&lt;/code&gt; for the developer's comfort&lt;/p&gt;

&lt;p&gt;Now go brag to all your friends that you are a C++ madlad/lass.  &lt;/p&gt;

</description>
      <category>cpp</category>
      <category>vscode</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
