Mingw environment variable configuration

Source: Internet
Author: User

In vs2005CodeCompilation is a little troublesome. Recently, I found something similar to compiling C in Linux under Windows, called mingw!

1. Install mingw
The installation file is in MinGW-5.1.4"
2. Configure Environment Variables
First, we first find the download link on www.mingw.org, and then download the network installation Program , Very small. The latest version is 5.1.4. Then click the mingw-5.1.4.exe, and then keep next, Select Download only, so that the next redo not go to the Internet to find. After the installation, click "mingw-5.1.4.exe" to install the package. However, the package is not downloaded again. When selecting the installation package, you can select all or by default, and then install the package, which is very simple.
It cannot be used after installation, because no environment variables have been set. Next we will set the environment variables. The installation path is in the C: \ mingw directory.
Right-click my computer and choose Properties> advanced> environment variable. Then:
1. Add c: \ mingw \ bin to the path. Remember to add a semicolon if there are other variables in it. The semicolon must be entered in the English input mode.
2. Create a New LIBRARY_PATH variable. If yes, add c: \ mingw \ Lib to the value, which is the location of the standard library.
3. Create the c_include_path variable and set it to c: \ mingw \ include.
4. Create a cplus_include_path variable with the value c: \ mingw \ include \ c ++ \ 3.4.5; C: \ mingw \ include \ c ++ \ 3.4.5; C: \ mingw \ include \ c ++ \ 3.4.5 \ backward; C: \ mingw \ include.

Now that the environment variable has been configured, open a cmd window and verify it to see if the environment variable has been configured successfully.
Input gcc-V in cmd to check what the output is. The output is not passed because the image cannot be passed.
Microsoft Windows XP [version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C: \ Documents ents and Settings \ Administrator> CD \

C: \> gcc-v
reading specs from D: /mingw/bin /.. /lib/GCC/mingw32/3.4.5/specs
configured :.. /gcc-3.4.5-20060117-3/configure -- With-GCC -- With-GNU-LD -- wi
TH-GNU-as -- Host = mingw32 -- target = mingw32 -- prefix =/mingw -- enable-threads -- Dis
able-NLS -- enable-extensions ages = C, C ++, f77, Ada, objc, Java -- disable-win32-registry -- d
Isable-shared -- enable-sjlj-exceptions -- enable-libgcj -- disable-Java-AWT -- with
out-X -- enable-Java-GC = Boehm -- disable-libgcj-Debug -- enable-interpreter -- enabl
E-hash-synchronization -- enable-libstdcxx-Debug
thread model: Win32
GCC version 3.4.5 (mingw-Vista special R3)

C: \>
3. set in Notepad ++ so that notepad ++ can compile and run C ++ Code
RUN notpad ++, click "Run-" run ". A pop-up box is displayed.
compile Source Code :
(GCC compilation below)
CMD/K gcc-O compiler (name_part1_.exe" $ (full_current_path) "& pause & Exit
(G ++ compiler)
CMD/K g ++-O Records (name_part0000.exe" $ (full_current_path) "& pause & Exit
run the executable file generated in the previous step:
CMD/K" $ (name_part) "& pause & Exit

Note:
The quotation marks must not be omitted if the file name or path contains spaces.
& Pause indicates that after the command is run, the pause waits for the keyboard operation
& Exit indicates that after the operation is complete, exit the running window and return to notepad ++.
The GCC bin directory has already been set in the system environment variables. Otherwise, you must complete the absolute path of the GCC command.

The following describes how to configure nppexec (used to build and run Java files ):

Build Java
--------------
Cd "$ (current_directory )"
D: \ Java \ jdk1.6.0 _ 03 \ bin \ javac.exe "$ (file_name )"
Or:

Run Java
-------------
Cd "$ (current_directory )"
D: \ Java \ jdk1.6.0 _ 03 \ bin \ java.exe "$ (name_part )"

Build & run Java
------------------------
Cd "$ (current_directory )"
D: \ Java \ jdk1.6.0 _ 03 \ bin \ javac.exe "$ (file_name )"
D: \ Java \ jdk1.6.0 _ 03 \ bin \ java.exe "$ (name_part )"

My compilation + run: F6 --> (Save the following content as run_g ++)

Npp_save // save changes before Compilation
G ++ $ (file_name) // compile the file
CMD/k a <in.txt & Exit // call the terminal to run the generated file and input data from in.txt.

In addition, I feel that the NPP commands of notepad ++ are getting more and more powerful, especially when running other commands in the console window.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.