#How to configure c environment variables in notepad?
Download and install Notepad, this step will not be repeated.
Install minGW (or copy the minGW folder, I personally feel it doesn’t matter whether you install it or not, it will not affect the use) to the C drive (other drives are also available, here we take the C drive as an example).
After completion, change the name of the minGW folder on the C drive to MinGW64.
Recommended: "notepad usage tutorial"
Add "C:\MinGW64\bin" to the system environment variable (C: \MinGW64 is the minGW you just copied or installed, there are a lot of things in it, don’t worry about it).
Check whether the compiler can be found by the system.
"Win key R", enter "cmd", press Enter to confirm, bring up the dos command window, enter: g -v, note that there is a space between g and -v, press Enter, you should be able to see The information as shown in the picture indicates that MinGW is ready to work. The red part indicates the mingw version used. I use mingw 5.3.0.
If it shows that g is not an internal command, or a similar prompt, you can restart and try again (it should not be a big problem after adding the environment variable correctly).
Let’s start with the key points:
Open notepad, press F5, or click "Run->Run" in the menu bar, the following dialog box will pop up, enter:
cmd /k cd /d "$(CURRENT_DIRECTORY)" & g++ "$(FILE_NAME)" -o "$(NAME_PART)" & "$(NAME_PART).exe"
Then click "Save".
After clicking "Save", the following dialog box will pop up to set the name and shortcut key of this command. For example: name enter "C/C compiler", shortcut (shortcut key ) can be set to what you are used to. Click "OK" and you're done.
Test run the following C code: (Save as "new 1.c")
#include <stdio.h> int main(void) { printf("Hello C World!\n"); return 0; }
Click the notepad menu bar "Run->C/C compiler", it works perfectly!
Test run the following C code: (save as "new 2.cpp")
#include <iostream> using namespace std; int main() { cout << "Hello C++ World!" << endl; return 0; }
Click the notepad menu bar "Run->C/C compiler", still runs perfectly!
The above is the detailed content of How to configure C environment variables in notepad. For more information, please follow other related articles on the PHP Chinese website!