[Original] Daily Construction Practice (2)

xiaoxiao2021-03-06  88

We have got all the code of the current project and put them in the specified directory. Here's how to build these code. This article introduces the vc batch process, it is to be noted that the process of VC6 is different, first we see how VC6 commands line build code.

1. Create a MAK file

The project file directly using VC6 cannot be compiled in the command line, so you must first guide the .mak file.

In the menu of the VC IDE, there is exportable feature, and he generates a corresponding MAK file in the project directory. In addition, in the VC settings can be set to export the MAK file at the same time, select this feature, your MAK file and the project file are synchronized.

The last job is to add the MAK file to the version management software. This should have a DEP file, which describes the dependencies of the file in the project. Since these items are relative path, it is a quite dangerous thing, it is recommended not to join, although this will not find it when this is compiled. Tip of the DEP file.

It should be noted that when your project is controlled under version management software, if the MAK file does not check out, the export failure is no prompt, so when the project file check out, the check out mak file is a must develop. good habits.

2. Set compilation path

If there is no option to set an environment variable when installing, you need to set the desired path before the compiler is running.

The standard path of the VC, and the VC6 is saved in VC98 / BIN / VCVARS32.BAT, you can copy the contents of the BAT to your own script. The standard script is as follows:

@echo off

REM

Rem Root of Visual Developer Studio Common Files.

Set vscommondir = c: / progra ~ 1 / micros ~ 3 / Common

REM

Rem Root of Visual Developer Studio INSTALLED FILES.

REM

SET MSDEVDIR = C: / Progra ~ 1 / Micros ~ 3 / Common / MSDEV98

REM

Rem Root of Visual C Installed Files.

REM

SET MSVCDIR = C: / Progra ~ 1 / Micros ~ 3 / VC98

REM

Rem vcosdir is buy to help create Either A Windows 95 or Windows NT Specific Path.

REM

Set vcosdir = Win95

IF "% os%" == "windows_nt" set vcosdir = Winnt

REM

Echo Setting Environment for Using Microsoft Visual C Tools.

REM

IF "% OS%" == "windows_nt" set path =% msdevdir% / bin;% msvcdir% / bin;% vscommondir% / Tools /% vcosdir%;% vscommondir% / Tools;% PATH%

IF "% OS%" == "" SET PATH = "% MSDEVDIR% / bin"; "% mscdir% / bin"; "% vscommondir% / Tools /% vcosdir%"; "% vscommondir% / Tools"; " % WINDIR% / system ";"% PATH% "

Set include =% msvcdir% / ATL / include;% msvcdir% / include;% include% SET lib =% msvcdir% / lib;% msvcdir% / mfc / lib;% lib%

SET VCOSDIR =

SET vscommondir =

Then you need to add a custom path, add an executable files in front of the path settings in VC to add an executable files;% include% before adding include files;% lib% Add library files.

Note: If you use the instructions similar to #Import , you must add a Windows system path to the% Path%:

% WINDIR% / system32

3. Build using Namke.exe

After the catalog settings are compiled, you can use the command build project directly:

NMAKE MyProject.mak

Use the-Clean parameter to clear the complication item:

nmake -clean myproject.mak

Use CFG to set compilation settings

Nmake mapchina.mak cfg = "MyProject - Win32 debug"

Note: The value of the CFG can be obtained from the MAK file and the project file. The MAK file contains a default setting. If the value of the CFG is not provided, this default setting is compiled.

Other commands and parameters provided by nmake, please see the documentation of MSDN

转载请注明原文地址:https://www.9cbs.com/read-107032.html

New Post(0)