VC ++ 6.0 compile CPP files in DOS environment

Source: Internet
Author: User

In the class, I saw the teacher compile the CPP file with Cl commands in the DOS environment. Come back and try it. Wow, I can't help it...

In the past, we had to set something called environment variables...

Method 1:


Find the vc98 \ bin \ vcvars32.bat file in the VC installation directory, open the CMD command prompt, drag it in, and press enter to get it done! However, it seems to be temporary and not verified. It's just fun. After all, the black box looks uncomfortable...

Of course, you can double-click it, and then it will flash and then open cmd. Here, you can clearly see the words completed, with a small sense of accomplishment.

Method 2:

Right-click "my computer"-properties-advanced-environment variables-Reference Method 4...

Method 3:

During installation, always find the option "whether to set environment variables", and select it. This is also the instructor's approach. ... No picture ..

Method 4:

Write a batch file (*. BAT) with the following content:
Set Path = c: \ Program Files \ Microsoft Visual Studio \ vc98 \ bin; C: \ Program Files \ Microsoft Visual Studio \ common \ msdev98 \ bin


Set include = c: \ Program Files \ Microsoft Visual Studio \ vc98 \ include; C: \ Program Files \ Microsoft Visual Studio \ vc98 \ MFC \ include


Set Lib = c: \ Program Files \ Microsoft Visual Studio \ vc98 \ Lib;
C: \ Program Files \ Microsoft Visual Studio \ vc98 \ MFC \ Lib

C: \ Program Files \ Microsoft Visual Studio must be replaced with your installation path.

Method 5: press the keyboard in cmd to set environment variables.

Note: When compiling a DOS environment, the-W parameter can be easily described... In the Visual C ++ environment, a long warning list is sometimes displayed in DOS... I didn't take a closer look at why.

For various reasons, I have not verified several details in this article.

 

My personal opinions are as follows:

In fact, the method is not so troublesome. You only need to set the environment variable and then edit the CPP file.

The method is as follows: Write a batch processing file (*. BAT) with the following content:

Set Path = D: \ c ++ \ bin; % PATH %
Set Lib = D: \ c ++ \ Lib; % lib %
Set include = D: \ c ++ \ include; % include % // set the environment variable here

Cl *. cpp // compile the *. cpp file.

Pause

This will generate the compilation file and the *. EXE executable file.

Where does bin, Lib, and include come from? Just copy the bin, Lib, and include folders in vc98 under the installation directory of VC ++ 6.0 and put them in the D: \ c ++ directory. Of course, you can set this directory by yourself.

In this way, an error occurs when you run the *. BAT file. Error message: "The mspdb60.dll is not found, so this application cannot be started ."

The file "mspdb60.dll" cannot be found in the installation directory! Where is this file?

The file is in the common \ msdev98 \ bin directory. You only need to copy the file to the bin folder in vc98 under the VC ++ 6.0 installation directory.

Now run the *. BAT file to compile the file.

I think this method is the simplest method. You are welcome to question it.

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.