“From today on, study hard and make progress every day”
Repetition is the best method for memory; spend one minute each day to remember the basics of C language.
“C Language Essential Knowledge Points for Beginners Series”“
03. The Most Comprehensive Guide to Setting Up a C Language Development Environment Across All Platforms
1. Why is it necessary to set up a development environment?
C is a compiled language, and the code needs to be converted into machine code by a compiler before execution. Setting up a development environment includes:
- 1. Editor: Writing code (e.g., VS Code, Notepad++)
- 2. Compiler: Converting code into executable files (e.g., GCC, Clang)
- 3. Debugging Tools: Checking for code errors (e.g., GDB)
2. Setting Up the Windows Environment
Method 1: MinGW (Recommended)
MinGW is a port of the GCC compiler for Windows.
Installation Steps
- 1. Download the MinGW installer: https://sourceforge.net/projects/mingw/
- 2. Run the installer and check:
- •
<span>mingw32-base</span>(Base package) - •
<span>mingw32-gcc-g++</span>(C++ support)
- • Add
<span>C:\MinGW\bin</span>to the system<span>Path</span>.
gcc --version
If version information (e.g., <span>gcc 8.1.0</span>) is displayed, the installation is successful.
Method 2: Dev-C++ (Suitable for Beginners)
Dev-C++ is an IDE that integrates both an editor and a compiler.
- 1. Download the installation package: https://sourceforge.net/projects/orwelldevcpp/
- 2. Use it directly after installation, no additional configuration is needed.
3. Linux/macOS Environment
Linux and macOS usually come with the GCC compiler pre-installed.
Check if GCC is installed
gcc --version
If not installed
- • Ubuntu/Debian:
sudo apt install build-essential - • macOS:
xcode-select --install
4. The First Test Program
Verify if the environment is working correctly.
- 1. Create a new file
<span>test.c</span>and write:#include <stdio.h> int main() { printf("C environment setup successful!\n"); return 0; } - 2. Compile and run:
- • Common command for Windows/Linux/macOS:
gcc test.c -o test ./test # Use test.exe for Windows
Environment setup successful!
5. Recommended Integrated Development Tools
| Tool | Applicable Scenarios | Features |
| VS Code | Cross-platform/Modern Editor | Lightweight, requires manual plugin configuration |
| Code::Blocks | Windows/Linux | Open-source IDE with built-in compiler |
| CLion | Professional Development | Paid, powerful debugging features |
| OnlineGDB | Web-based online practice | No installation required, ready to use |
6. Common Issues
1. Compilation error: “gcc is not an internal command”
- • Indicates that the environment variable is not configured correctly; check if
<span>Path</span>includes the GCC<span>bin</span>directory.
2. How to debug a program?
- • Use
<span>gdb</span>(GNU Debugger):gcc -g test.c -o test # Add -g parameter during compilation gdb ./test
3. Are there simpler online tools available?
- • Recommended: https://www.onlinegdb.com/ or https://www.online-compiler.com/, no installation required to write and run C code.
7. Conclusion
- • Windows users are recommended to use MinGW or Dev-C++
- • Linux/macOS usually come with GCC pre-installed
- • Verify successful environment setup: compile and run the test program
———- End ———-
[Special Statement: All articles in this public account are original or authorized by the author, some content and images are sourced from the internet and AI, please feel free to use, opinions are for learning reference only~~]

“If you like C, please like it”
Click the bottom right to see
“