Configure vs Compiler on Windows notepad++, compile and run

Source: Internet
Author: User
Tags visual studio 2010

Configuring VS Compilers in Windows

Under Linux, Kris is inclined to use GCC and g++ in the terminal to compile C + +, and in Windows I believe many people are choosing a bloated visual Studio. However, I would like to be able to program under Windows as well as Linux, so I started my C + + command-line build environment under Windows.

Few people will deny that the integrated development environment (IDE) (for example, Visual Studio,netbeans,eclipse) offers many features that make programming work quite simple. But, let's talk about the benefits of command-line compilation.

1. Preference for the simplest generation
2. Want to uncover the secret of how the IDE handles source code files
3, in-depth understanding of computer language and to be extended

In fact, the feeling of compiling with command-line tools will prove helpful.

   How do I build a C + + command-line compilation environment under Windows? Using Cygwin to simulate a Linux environment on Windows and then take advantage of gcc/g++, this is also a complicated toss-up. Now that I have visual Studio installed, I should make good use of its CL compiler. OK, the steps are recorded as follows (here is a description of my environment is windows 7 + Visual Studio 2010, where the VS 2010 installation location is D drive):

  1, modify environment variables
      in System Properties-advanced-environment variables-User variables:
     edit Path to add cl compiler paths D:\Program Files\Microsoft Visual The paths of Studio 10.0\vc\bin and MSPDB60.DLL D:\Program Files\Microsoft Visual Studio10.0\common7\ide, separated by semicolons.
     new variable include:d:\program Files\Microsoft Visual Studio10.0\vc\include
      new variable lib:d:\program Files\Microsoft Visual Studio 10.0\vc\lib

  2, running CL in command prompt (CMD), If the error message link:fatal error LNK1104: Unable to open the file "Kernel32.lib", C:\Program Files\Microsoft Sdks\windows\v7.0a\ The kernel32.lib copy under the Lib directory to the D:\Program Files\Microsoft Visual Studio10.0\vc\lib directory.

3. Write a C language applet. Go from cmd to the program directory you wrote and execute the CL file name. C. After execution you will see that the file name. obj file is the same as the makefile filename. exe file. You can execute your program by entering the filename. exe within the CMD window.

notepad++ Link vs Compiler

1. Create a C program in notepad++

2. Link vs Compiler

Click on the navigation bar to execute (RUN/F5) in the input box to write cmd/k chdir/d $ (current_directory) & CL $ (file_name) & PAUSE & EXIT and join the shortcut key click OK , complete this step to compile the C program in notepad++ using the VS compiler.

3. Create execution (EXE file) shortcut keys

Click the Execute option in the navigation bar to write cmd/k chdir/d $ (current_directory) & CL "$ (name_part). exe" & PAUSE & EXIT also creates a shortcut key in the input box to determine the Execute the program you have written.

Related Article

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.