Home > Development Tools > notepad > body text

How to configure C environment variables in notepad

藏色散人
Release: 2019-11-14 11:10:48
Original
4392 people have browsed it

How to configure C environment variables in notepad

#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"

How to configure C environment variables in notepad

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).

How to configure C environment variables in notepad

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).

How to configure C environment variables in notepad

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"
Copy after login

Then click "Save".

How to configure C environment variables in notepad

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.

How to configure C environment variables in notepad

Test run the following C code: (Save as "new 1.c")

#include <stdio.h>
int main(void)
{
    printf("Hello C World!\n");
    return 0;
}
Copy after login

Click the notepad menu bar "Run->C/C compiler", it works perfectly!

How to configure C environment variables in notepad

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;
}
Copy after login

Click the notepad menu bar "Run->C/C compiler", still runs perfectly!

How to configure C environment variables in notepad

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template