[Solved] the preLaunchTask 'C/C++:gcc.exe build active file' terminated with exit code -1 (VS Code)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
pre-launch task CC plus plus colon gcc.x build active file terminated with exit code -1 error in Visual Studio code versus code is a common issue faced by C plus plus Developers this error occurs when the integrated terminal inverses code cannot locate the GCC compiler which is required to build run and debug C plus programs in this article we will discuss all the possible reasons which can cause this issue and the ways to solve them we're confident that by the end of this article you'll have solved this error in your computer system as discussed earlier this problem occurs when the terminal inside versus code fails to run the GCC compiler when trying to build your program however there could be multiple reasons why versus code isn't able to locate or run the GCC compiler we'll discuss all of them and provide solutions to them the steps to detect and solve the error are given below this is to ensure that the compiler responsible for compiling your C plus code is actually installed in your system in command prompt Powershell or any other terminal installed in your system type GCC version if GCC is installed correctly its version number will be displayed on the screen as shown below otherwise it means that GCC is not installed in your system properly and you need to install GCC first from here if the GCC version command doesn't work on your terminal even after installing GCC you need to check whether the environment variable is correctly set up for GCC to check the same press control plus r to open the Run box type system.cpr and hit enter the system properties window will open go to the advanced Tab and click on the environment variables Button as shown in the picture below the list of user and system variables will appear now select the path variable from under user variables and double-click on it make sure the location of your GCC compiler's executable is mentioned there if not add it there in the picture given below we've used Mingle 64. the CC plus plus extension for versus code configures the GCC environment for programs to be built and run in versus code smoothly go to the extensions tab in versus code Control Plus shift plus X Type CC plus plus and install the extension if not already installed press control plus shift plus P inside versus code to launch the command palette and type CC plus plus edit configurations UI select the option shown in the picture given below and hit enter make sure that all the values in your configuration match the values given below compiler path this varies based on your GCC installation path and operating system double check to make sure that the location mentioned in your compiler path is correct or not if not update it with the right location of the GCC executable intellisense mode as shown in the image below include path colon dollar workspace folder defines as shown in a given image see standard new 17c plus plus standard new plus plus 17 I hope that this article was helpful in resolving that the pre-launch tasks CC plus plus colon GCC dot X build active file terminated with exit code -1 error in Visual Studio code versus code by following the steps outlined in the article you should be able to get back to building and running C plus plus programs in versus code without any further issues if you still encounter any issues or have further questions please feel free to comment down below and I'll try my best to help you out
Info
Channel: TechRBun
Views: 33,082
Rating: undefined out of 5
Keywords:
Id: qCqNnnbIbqo
Channel Id: undefined
Length: 4min 24sec (264 seconds)
Published: Mon Aug 14 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.