Section 1: Introduction“Before typing my first line of code, I was almost discouraged by C language…”“Want to write your first line of C code but got stuck on configuration—spending half an hour installing the compiler without success, changing environment variables until dizzy, and encountering a bunch of errors, unable to run even ‘hello world’? Don’t panic! These ‘configuration nightmares’ are hurdles every C language beginner must overcome. Today, we will unveil the ‘mystery of configuration’ and break down the process of installing the compiler, adjusting the environment, and troubleshooting errors into a step-by-step ‘nanny guide’. After all, getting discouraged before writing even two lines of code? That’s not what we do!”Section 2: Downloading C/C++“Are you still using the classic editor VSCode + Mingw C?”✅1. Installing VSCode: No need to elaborate here, just install the official Microsoft C/C++ Extension Pack.
✅2. Installing C/C++ Compiler and Debugger: We will use the pre-packaged compiler and debugger from mingw-w64. First, go to the official websitehttps://www.mingw-w64.org/downloads/, find MinGW-W64-builds, and navigate to the GitHub page.
🔍Many students will ask which version to download here. For Windows 10 and 11, download the version in the red box; for older systems, choose the version above the red box.
Some people will ask: What’s the difference between so many versions? Don’t worry, here is a WeChat article: Downloading and Installing MinGW-w64, which explains it in detail!In short: This version is currently the most recommended version!!!✅3. Downloading Precompiled Files: Many people encounter the ‘fatal blow’ of GitHub DNS pollution here
. Downloading from other sites often comes with various charges! Don’t panic, I have already downloaded it for you and checked it with virscan for no viruses, freely provided to everyone! (Download link in the comments section)
✅4. Extracting and Installing: 【Extraction】 Note!! The path after extraction cannot contain any Chinese characters, otherwise the compiler will report an error! For example, my extraction directory isD:\mingw.【Installation】 Modify the environment variables, click the copilot key or win+S, call up the search box, search for ‘environment variables’, click ‘Edit system environment variables’, then edit user variables, and add the path you just extracted to the Path variable+in, such asD:\mingw\bin, and save.
✅5. Verification: Open cmd, enter<span class="language-plaintext">gcc -v</span> or <span class="language-plaintext">gcc -version</span> and you should see a prompt!
Section 3: Conclusion “Done?”✅ Don’t rush, you still need to configure the launch file launch.json for VSCode. Just find a few tutorials on the website, or directly input the error code; there will definitely be more experts providing feedback! ✅ Recommended website for learning C++: https://www.w3schools.com/cpp/cpp_getstarted.asp✅ The path of .cpp files must also be entirely in English!!✅ Thanks to CSDN user 【沧海一笑-dj】 for the text–“Read the original text”Any questions or shortcomings, please point them out in the comments section!