<?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: Abhishek S</title>
    <description>The latest articles on DEV Community by Abhishek S (@abhisheksankar).</description>
    <link>https://dev.to/abhisheksankar</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%2F241848%2F86f9842c-9a68-41de-b4e9-a1713bfa4f22.png</url>
      <title>DEV Community: Abhishek S</title>
      <link>https://dev.to/abhisheksankar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/abhisheksankar"/>
    <language>en</language>
    <item>
      <title>Debugging C++ in macOS </title>
      <dc:creator>Abhishek S</dc:creator>
      <pubDate>Mon, 24 Aug 2020 05:04:11 +0000</pubDate>
      <link>https://dev.to/abhisheksankar/debugging-c-in-macos-10hi</link>
      <guid>https://dev.to/abhisheksankar/debugging-c-in-macos-10hi</guid>
      <description>&lt;p&gt;&lt;span&gt;Cover photo by &lt;a href="https://unsplash.com/@clemhlrdt?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Clément H&lt;/a&gt; on &lt;a href="https://unsplash.com/s/photos/programming?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Unsplash&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  Trying to figure out how to add user input while debugging C++ on macOS in VScode? You've come to the right place. I spent a load of time figuring it out so that you don't have to.
&lt;/h5&gt;

&lt;h6&gt;
  
  
  Aight, I'll make this post a tl;dr and give references for further reading at the bottom.
&lt;/h6&gt;

&lt;h2&gt;
  
  
  Step #1
&lt;/h2&gt;

&lt;h5&gt;
  
  
  Update your tasks.json file (In case you don't know what that is, I suggest you head over &lt;a href="https://code.visualstudio.com/docs/editor/debugging"&gt;here&lt;/a&gt; and then get back) with the following piece of code.
&lt;/h5&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zufI2xgE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/vd2rsfxhrs5cnguatkkc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zufI2xgE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/vd2rsfxhrs5cnguatkkc.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;{"label": "Open Terminal",&lt;br&gt;
"type": "shell",&lt;br&gt;
"command": "osascript -e 'tell application \"Terminal\"\ndo script \"echo hello\"\nend tell'",&lt;br&gt;
"problemMatcher": []&lt;br&gt;
}&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  Now just run this task before running the c++ file, and in the launch.json, set
&lt;/h4&gt;

&lt;p&gt;&lt;br&gt;
 &lt;code&gt;externalConsole: true&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;h5&gt;
  
  
  Your tasks.json should look something like this now.
&lt;/h5&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NaD0MVwa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ivy6e5ic7a6kg301lnwi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NaD0MVwa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ivy6e5ic7a6kg301lnwi.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step #2
&lt;/h2&gt;

&lt;h4&gt;
  
  
  Now hit
&lt;/h4&gt;

&lt;p&gt;&lt;br&gt;
 &lt;code&gt;cmd + shift + P&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
 and type in "&amp;gt;run tasks" without the quotes of course.&lt;/p&gt;
&lt;h4&gt;
  
  
  And you should see something like this.
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gAaDPVzQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/p58169ah59wy9bxkgjzq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gAaDPVzQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/p58169ah59wy9bxkgjzq.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h5&gt;
  
  
  Click on
&lt;/h5&gt;

&lt;p&gt;&lt;br&gt;
 &lt;code&gt;open terminal&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;h5&gt;
  
  
  and it launches a terminal. Smash the allow button once twice or as often as it asks and you're set.
&lt;/h5&gt;

&lt;h3&gt;
  
  
  Boom.
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8jKL-Xa0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ffyxwz3b0x9i9stvrah0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8jKL-Xa0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ffyxwz3b0x9i9stvrah0.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  You'll have the terminal launched, and now when you run the actual g++-10 debug and run task, it should work fine.
&lt;/h5&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Db9GVCXp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/3dumlimysje683th01q7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Db9GVCXp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/3dumlimysje683th01q7.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  See how the editor is in debug mode, and the terminal on the left is ready to accept input.
&lt;/h5&gt;

&lt;h5&gt;
  
  
  Hopefully this helped :)
&lt;/h5&gt;

&lt;h6&gt;
  
  
  In case you'd like to know more about this issue, head over &lt;a href="https://github.com/microsoft/vscode-cpptools/issues/5079"&gt;here&lt;/a&gt;
&lt;/h6&gt;

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