{"id":1327,"date":"2022-09-17T05:20:54","date_gmt":"2022-09-17T05:20:54","guid":{"rendered":"https:\/\/learntube.ai\/blog\/?p=1327"},"modified":"2022-10-13T05:37:06","modified_gmt":"2022-10-13T05:37:06","slug":"how-to-compile-your-c-code-in-visual-studio-code","status":"publish","type":"post","link":"https:\/\/learntube.ai\/blog\/programming\/c\/how-to-compile-your-c-code-in-visual-studio-code\/","title":{"rendered":"How To Compile Your C++ Code in Visual Studio Code"},"content":{"rendered":"\n<p>This article was written since we wanted to use a compiler for a C++ project. Everyone was using the IDEs for CodeBlocks and Visual Studio as usual. However, we were already used to utilizing Visual Studio Code for all of our programming requirements. Following that, I set out to discover a way to compile C++ directly in my VsCode Editor, which led to the production of this article. So, in this article, we&#8217;ll show you how to set up your compiler in Visual Studio Code.<\/p>\n\n\n\n<p><strong>Get a C++ compiler and install it: <\/strong>To download the MinGW setup file, go to www.mingw.org and click the &#8220;Download\/Installer&#8221; link, or go here for Windows, here for Linux, and here for Mac. Install MinGW after it has finished downloading and wait for the &#8220;MinGW Installation Manager&#8221; to appear. When the &#8220;MinGW Installation Manager&#8221; appears, select mingw32-gcc-g++ from the drop-down menu and then &#8220;Mark for Installation.&#8221; Click &#8220;Installation &gt; Apply Changes&#8221; in the top left corner of the menu. Allow time for the installation to complete. During this process, make sure you have a solid internet connection.<\/p>\n\n\n\n<p><strong>To add the location where the C++ compiler is located in your PATH environment variable, make the following changes: <\/strong>MinGW can be found under C:MinGWbin after it has been installed. You must now add this directory to your PATH environment variable. If you&#8217;ve been using computers for a time, you should already be able to do this.<\/p>\n\n\n\n<p><strong>In VS Code, install the Code Runner extension: <\/strong>Let&#8217;s install Code Runner now that we&#8217;ve completed setting up our compiler. Code Runner lets you run code snippets or entire code files in a variety of languages, including C, C++, Java, JavaScript, PHP, Python, Perl, Perl 6, Ruby, Go, Lua, Groovy, PowerShell, BAT\/CMD, BASH\/SH, F# Script, F# (.NET Core), C# Script, C# (.NET Core), VBScript, TypeScript, CoffeeScript, Scala, Julia, Crystal, OC. After installing restart the Visual studio code. Open your C++ file in Visual studio code.<\/p>\n\n\n\n<p><strong>Use Code Runner to run your code:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Use Ctrl+Alt+N<\/li><li>Run Code after pressing F1.<\/li><li>In the editor context menu, right-click the Text Editor and select Run Code.<\/li><\/ul>\n\n\n\n<p>The code will be executed, and the results will be displayed in the Output Window. Using the &#8216;Ctrl+ shortcut, open the output window.<\/p>\n\n\n\n<p>VsCode&#8217;s output terminal is read-only by default. It means that by default, you can&#8217;t utilise the terminal to take input. You must manually enable read-write to remedy this. The steps are as follows:<\/p>\n\n\n\n<p>Go to File &gt; Preference &gt; Setting in VsCode.<\/p>\n\n\n\n<p>Find the extensions section in the User tab on the left panel.<\/p>\n\n\n\n<p>&#8216;Run Code Configuration&#8217; can be found by scrolling down.<\/p>\n\n\n\n<p>Locate a checkbox by scrolling. In a terminal, run (Whether to run code in Integrated Terminal) Make a check in the box.<\/p>\n\n\n\n<p><strong>Final Thoughts:<\/strong> The advice in the above list is only a fundamental understanding of visual studio code. To become a visual studio champion, you can learn more about related topics on YouTube. You can use <a href=\"https:\/\/app.learntube.ai\/\">Learn Tube<\/a> by <a href=\"https:\/\/careerninja.in\/\">Career Ninja<\/a> to enhance your YouTube learning. If you type up &#8220;Visual studio code tutorial&#8221; on Youtube, you&#8217;ll get a bunch of videos. A beginner will be confused because he or she will not know which video to select. Learn tube helps in the organization of YouTube search videos into a course style. So you don&#8217;t have to click on each and every video. It also provides online specialists who can assist you with your questions.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article was written since we wanted to use a compiler for a C++ project. Everyone was using the IDEs for CodeBlocks and Visual Studio as usual. However, we were already used to utilizing Visual Studio Code for all of our programming requirements. Following that, I set out to discover a way to compile C++ [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1531,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","footnotes":""},"categories":[96,28],"tags":[],"class_list":{"0":"post-1327","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-c","8":"category-programming"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How To Compile Your C++ Code in Visual Studio Code - Learn Tube<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/learntube.ai\/blog\/programming\/how-to-compile-your-c-code-in-visual-studio-code\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Compile Your C++ Code in Visual Studio Code - Learn Tube\" \/>\n<meta property=\"og:description\" content=\"This article was written since we wanted to use a compiler for a C++ project. Everyone was using the IDEs for CodeBlocks and Visual Studio as usual. However, we were already used to utilizing Visual Studio Code for all of our programming requirements. Following that, I set out to discover a way to compile C++ [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/learntube.ai\/blog\/programming\/how-to-compile-your-c-code-in-visual-studio-code\/\" \/>\n<meta property=\"og:site_name\" content=\"Learn Tube\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/CareerNinjaIndia\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-09-17T05:20:54+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-10-13T05:37:06+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/learntube.ai\/blog\/wp-content\/uploads\/2022\/09\/2835143-2-scaled.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"2560\" \/>\n\t<meta property=\"og:image:height\" content=\"1707\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Team LearnTube\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Team LearnTube\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/learntube.ai\/blog\/programming\/how-to-compile-your-c-code-in-visual-studio-code\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/learntube.ai\/blog\/programming\/how-to-compile-your-c-code-in-visual-studio-code\/\"},\"author\":{\"name\":\"Team LearnTube\",\"@id\":\"https:\/\/learntube.ai\/blog\/#\/schema\/person\/0f4e519a2115e9be9c8083e7a41a4e07\"},\"headline\":\"How To Compile Your C++ Code in Visual Studio Code\",\"datePublished\":\"2022-09-17T05:20:54+00:00\",\"dateModified\":\"2022-10-13T05:37:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/learntube.ai\/blog\/programming\/how-to-compile-your-c-code-in-visual-studio-code\/\"},\"wordCount\":599,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/learntube.ai\/blog\/#organization\"},\"articleSection\":[\"C++\",\"Programming\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/learntube.ai\/blog\/programming\/how-to-compile-your-c-code-in-visual-studio-code\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/learntube.ai\/blog\/programming\/how-to-compile-your-c-code-in-visual-studio-code\/\",\"url\":\"https:\/\/learntube.ai\/blog\/programming\/how-to-compile-your-c-code-in-visual-studio-code\/\",\"name\":\"How To Compile Your C++ Code in Visual Studio Code - Learn Tube\",\"isPartOf\":{\"@id\":\"https:\/\/learntube.ai\/blog\/#website\"},\"datePublished\":\"2022-09-17T05:20:54+00:00\",\"dateModified\":\"2022-10-13T05:37:06+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/learntube.ai\/blog\/programming\/how-to-compile-your-c-code-in-visual-studio-code\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/learntube.ai\/blog\/programming\/how-to-compile-your-c-code-in-visual-studio-code\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/learntube.ai\/blog\/programming\/how-to-compile-your-c-code-in-visual-studio-code\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/learntube.ai\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How To Compile Your C++ Code in Visual Studio Code\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/learntube.ai\/blog\/#website\",\"url\":\"https:\/\/learntube.ai\/blog\/\",\"name\":\"LearnTube\",\"description\":\"10000+ Free Courses with Free Certification and doubt solving -\",\"publisher\":{\"@id\":\"https:\/\/learntube.ai\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/learntube.ai\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/learntube.ai\/blog\/#organization\",\"name\":\"LearnTube\",\"url\":\"https:\/\/learntube.ai\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/learntube.ai\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/learntube.ai\/blog\/wp-content\/uploads\/2022\/04\/1645302407Colourpng.png\",\"contentUrl\":\"https:\/\/learntube.ai\/blog\/wp-content\/uploads\/2022\/04\/1645302407Colourpng.png\",\"width\":3000,\"height\":742,\"caption\":\"LearnTube\"},\"image\":{\"@id\":\"https:\/\/learntube.ai\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/CareerNinjaIndia\/\",\"https:\/\/www.instagram.com\/careerninjaindia\/\",\"https:\/\/www.linkedin.com\/company\/careerninja\/\",\"https:\/\/www.youtube.com\/c\/CareerNinja\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/learntube.ai\/blog\/#\/schema\/person\/0f4e519a2115e9be9c8083e7a41a4e07\",\"name\":\"Team LearnTube\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/learntube.ai\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/2f280aa676ba5daf1e7407bffa25f05d95bb67811711176adde8cf8440982486?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/2f280aa676ba5daf1e7407bffa25f05d95bb67811711176adde8cf8440982486?s=96&d=mm&r=g\",\"caption\":\"Team LearnTube\"},\"sameAs\":[\"https:\/\/learntube.ai\/blog\"],\"url\":\"https:\/\/learntube.ai\/blog\/author\/team-learntube\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How To Compile Your C++ Code in Visual Studio Code - Learn Tube","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/learntube.ai\/blog\/programming\/how-to-compile-your-c-code-in-visual-studio-code\/","og_locale":"en_US","og_type":"article","og_title":"How To Compile Your C++ Code in Visual Studio Code - Learn Tube","og_description":"This article was written since we wanted to use a compiler for a C++ project. Everyone was using the IDEs for CodeBlocks and Visual Studio as usual. However, we were already used to utilizing Visual Studio Code for all of our programming requirements. Following that, I set out to discover a way to compile C++ [&hellip;]","og_url":"https:\/\/learntube.ai\/blog\/programming\/how-to-compile-your-c-code-in-visual-studio-code\/","og_site_name":"Learn Tube","article_publisher":"https:\/\/www.facebook.com\/CareerNinjaIndia\/","article_published_time":"2022-09-17T05:20:54+00:00","article_modified_time":"2022-10-13T05:37:06+00:00","og_image":[{"width":2560,"height":1707,"url":"https:\/\/learntube.ai\/blog\/wp-content\/uploads\/2022\/09\/2835143-2-scaled.jpg","type":"image\/jpeg"}],"author":"Team LearnTube","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Team LearnTube","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/learntube.ai\/blog\/programming\/how-to-compile-your-c-code-in-visual-studio-code\/#article","isPartOf":{"@id":"https:\/\/learntube.ai\/blog\/programming\/how-to-compile-your-c-code-in-visual-studio-code\/"},"author":{"name":"Team LearnTube","@id":"https:\/\/learntube.ai\/blog\/#\/schema\/person\/0f4e519a2115e9be9c8083e7a41a4e07"},"headline":"How To Compile Your C++ Code in Visual Studio Code","datePublished":"2022-09-17T05:20:54+00:00","dateModified":"2022-10-13T05:37:06+00:00","mainEntityOfPage":{"@id":"https:\/\/learntube.ai\/blog\/programming\/how-to-compile-your-c-code-in-visual-studio-code\/"},"wordCount":599,"commentCount":0,"publisher":{"@id":"https:\/\/learntube.ai\/blog\/#organization"},"articleSection":["C++","Programming"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/learntube.ai\/blog\/programming\/how-to-compile-your-c-code-in-visual-studio-code\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/learntube.ai\/blog\/programming\/how-to-compile-your-c-code-in-visual-studio-code\/","url":"https:\/\/learntube.ai\/blog\/programming\/how-to-compile-your-c-code-in-visual-studio-code\/","name":"How To Compile Your C++ Code in Visual Studio Code - Learn Tube","isPartOf":{"@id":"https:\/\/learntube.ai\/blog\/#website"},"datePublished":"2022-09-17T05:20:54+00:00","dateModified":"2022-10-13T05:37:06+00:00","breadcrumb":{"@id":"https:\/\/learntube.ai\/blog\/programming\/how-to-compile-your-c-code-in-visual-studio-code\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/learntube.ai\/blog\/programming\/how-to-compile-your-c-code-in-visual-studio-code\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/learntube.ai\/blog\/programming\/how-to-compile-your-c-code-in-visual-studio-code\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/learntube.ai\/blog\/"},{"@type":"ListItem","position":2,"name":"How To Compile Your C++ Code in Visual Studio Code"}]},{"@type":"WebSite","@id":"https:\/\/learntube.ai\/blog\/#website","url":"https:\/\/learntube.ai\/blog\/","name":"LearnTube","description":"10000+ Free Courses with Free Certification and doubt solving -","publisher":{"@id":"https:\/\/learntube.ai\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/learntube.ai\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/learntube.ai\/blog\/#organization","name":"LearnTube","url":"https:\/\/learntube.ai\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/learntube.ai\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/learntube.ai\/blog\/wp-content\/uploads\/2022\/04\/1645302407Colourpng.png","contentUrl":"https:\/\/learntube.ai\/blog\/wp-content\/uploads\/2022\/04\/1645302407Colourpng.png","width":3000,"height":742,"caption":"LearnTube"},"image":{"@id":"https:\/\/learntube.ai\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/CareerNinjaIndia\/","https:\/\/www.instagram.com\/careerninjaindia\/","https:\/\/www.linkedin.com\/company\/careerninja\/","https:\/\/www.youtube.com\/c\/CareerNinja"]},{"@type":"Person","@id":"https:\/\/learntube.ai\/blog\/#\/schema\/person\/0f4e519a2115e9be9c8083e7a41a4e07","name":"Team LearnTube","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/learntube.ai\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/2f280aa676ba5daf1e7407bffa25f05d95bb67811711176adde8cf8440982486?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/2f280aa676ba5daf1e7407bffa25f05d95bb67811711176adde8cf8440982486?s=96&d=mm&r=g","caption":"Team LearnTube"},"sameAs":["https:\/\/learntube.ai\/blog"],"url":"https:\/\/learntube.ai\/blog\/author\/team-learntube\/"}]}},"uagb_featured_image_src":{"full":["https:\/\/learntube.ai\/blog\/wp-content\/uploads\/2022\/09\/2835143-2-scaled.jpg",2560,1707,false],"thumbnail":["https:\/\/learntube.ai\/blog\/wp-content\/uploads\/2022\/09\/2835143-2-150x150.jpg",150,150,true],"medium":["https:\/\/learntube.ai\/blog\/wp-content\/uploads\/2022\/09\/2835143-2-300x200.jpg",300,200,true],"medium_large":["https:\/\/learntube.ai\/blog\/wp-content\/uploads\/2022\/09\/2835143-2-768x512.jpg",696,464,true],"large":["https:\/\/learntube.ai\/blog\/wp-content\/uploads\/2022\/09\/2835143-2-1024x683.jpg",696,464,true],"1536x1536":["https:\/\/learntube.ai\/blog\/wp-content\/uploads\/2022\/09\/2835143-2-1536x1024.jpg",1536,1024,true],"2048x2048":["https:\/\/learntube.ai\/blog\/wp-content\/uploads\/2022\/09\/2835143-2-2048x1365.jpg",2048,1365,true],"td_218x150":["https:\/\/learntube.ai\/blog\/wp-content\/uploads\/2022\/09\/2835143-2-218x150.jpg",218,150,true],"td_324x400":["https:\/\/learntube.ai\/blog\/wp-content\/uploads\/2022\/09\/2835143-2-324x400.jpg",324,400,true],"td_485x360":["https:\/\/learntube.ai\/blog\/wp-content\/uploads\/2022\/09\/2835143-2-485x360.jpg",485,360,true],"td_696x0":["https:\/\/learntube.ai\/blog\/wp-content\/uploads\/2022\/09\/2835143-2-696x464.jpg",696,464,true],"td_1068x0":["https:\/\/learntube.ai\/blog\/wp-content\/uploads\/2022\/09\/2835143-2-1068x712.jpg",1068,712,true],"td_1920x0":["https:\/\/learntube.ai\/blog\/wp-content\/uploads\/2022\/09\/2835143-2-1920x1280.jpg",1920,1280,true],"td_324x235":["https:\/\/learntube.ai\/blog\/wp-content\/uploads\/2022\/09\/2835143-2-324x235.jpg",324,235,true]},"uagb_author_info":{"display_name":"Team LearnTube","author_link":"https:\/\/learntube.ai\/blog\/author\/team-learntube\/"},"uagb_comment_info":0,"uagb_excerpt":"This article was written since we wanted to use a compiler for a C++ project. Everyone was using the IDEs for CodeBlocks and Visual Studio as usual. However, we were already used to utilizing Visual Studio Code for all of our programming requirements. Following that, I set out to discover a way to compile C++&hellip;","_links":{"self":[{"href":"https:\/\/learntube.ai\/blog\/wp-json\/wp\/v2\/posts\/1327","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/learntube.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/learntube.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/learntube.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/learntube.ai\/blog\/wp-json\/wp\/v2\/comments?post=1327"}],"version-history":[{"count":1,"href":"https:\/\/learntube.ai\/blog\/wp-json\/wp\/v2\/posts\/1327\/revisions"}],"predecessor-version":[{"id":1331,"href":"https:\/\/learntube.ai\/blog\/wp-json\/wp\/v2\/posts\/1327\/revisions\/1331"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/learntube.ai\/blog\/wp-json\/wp\/v2\/media\/1531"}],"wp:attachment":[{"href":"https:\/\/learntube.ai\/blog\/wp-json\/wp\/v2\/media?parent=1327"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/learntube.ai\/blog\/wp-json\/wp\/v2\/categories?post=1327"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/learntube.ai\/blog\/wp-json\/wp\/v2\/tags?post=1327"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}