2.3 Creating a project
[Make File] The Make tool provides comparative compilation of the comparison batch of each processing module, requiring a Makefile to represent the respective relationships of the modules in the project. The current VC does not require us to care for these details, and do not even need to use them.
Or COM, if you need to generate a proxy / stub's proxy control, you need to use make and makefile nmake -nf projectnameps.mk
Makefile of the above example (use VC's Project-> Export Makefile)
# Microsoft Developer Studio Generated Nmake File, Based On Client.dsp! IF "$ (cfg)" == "" CFG = Client - Win32 Debug! Message No Configuration Specified. Defaulting to Client - Win32 Debug.! Endif.!
! If "$ (cfg)"! = "Client - Win32 Release" && "$ (cfg)"! = "Client - Win32 Debug"! Message Invalid Configuration "$ (cfg)" Specified.! Message You CAN Specify A Configuration when running NMAKE MESSAGE by defining the macro CFG on the command line for example: MESSAGE MESSAGE NMAKE / f "client.mak" CFG = "client - Win32 Debug" MESSAGE MESSAGE Possible choices for configuration are:!.!! MESSAGE!!! ! MESSAGE "client - Win32 Release" (based on "Win32 (x86) Console Application") MESSAGE!!! "client - Win32 Debug" (based on "Win32 (x86) Console Application") MESSAGE ERROR An invalid configuration is specified. ! ENDIF
! If "$ (os) ==" windows_nt "null =! Else null = NUL! ENDIF
CPP = cl.exe RSC = rc.exe
! IF "$ (cfg) ==" Client - Win32 Release "
Outdir =. / Release intDir =. / Release # begin Custom Macros Outdir =. / Release # end custom macros
All: "$ (outdir) /client.exe"
Clean: - @ Erase "$ (intDir) /client.obj" - @ Erase "$ (intDir) /client.pch" - @ Erase "$ (intDir) /stdafx.obj" - @ Erase "$ (INTDIR) / VC60.IDB "- @ Erase" $ (outdir) /client.exe "
"$ (Outdir): if not exist" $ (outdir) / $ (NULL) "MKDIR" $ (outdir)
CPP_Proj = / NOLOGO / ML / W3 / GX / O2 / D "WIN32" / D "ndebug" / d "_console" / d "_mbcs" /fp" full "/YU "/client.h" /YU "stdafx.h "/ Fo" $ (intDir) // "/ fd" $ (intDir) // "/ fd / c bsc32 = bscmake.exe bsc32_flags = / nologo /o" (outdir )/client.bsc "bsc32_sbrs = / link32 = link.exe LINK32_FLAGS = kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32. lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib / nologo / subsystem: console / incremental: no /pdb:"$(OUTDIR)/client.pdb "/ Machine: i386 /out:" $(Outdir )/client.exe" link32_objs = / "$ (intedir) /stdafx.obj" / "$ (intDir) /client.obj
"$ (Outdir) /client.exe": "$ (outdir)" $ (def_file) $ (link32_objs) $ (link32) @ << $ (link32_flags) $ (link32_objs) <<
! Elseif "$ (cfg)" == "Client - Win32 Debug"
Outdir =. / Debug intedir =. / Debug # begin custom macros outdir =. / Debug # End Custom Macros
All: "$ (outdir) /client.exe" "$ (outdir) /client.bsc"
Clean: - @ Erase "$ (intDir) /client.obj" - @ ERASE "$ (intDir) /client.pch" - @ Erase "$ (intDir) /client.sbr" @ Erase "$ (intDir) / STDAFX.OBJ "- @ Erase" $ (intDir) /stdafx.sbr "- @ Erase" $ (intDir) /VC60.IDB "- @ Erase" $ (intDir) /VC60.pdb "- @ Erase" $ (Outdir ) /client.bsc "- @ Erase" $ (outdir) /client.exe "- @ Erase" $ (outdir) /client.ilk "- @ Erase" $ (outdir) /client.pdb "$ (outdir) ": If not exist" $ (outdir) / $ (NULL) "MKDIR" $ (outdir)
CPP_Proj = / NOLOGO / MLD / W3 / GM / GX / ZI / OD / D "WIN32" / D "_debug" / d "_console" / d "_mbCS" / fr "$ (intDir) //" / fp "$ (IntDir) /client.pch "/yu "stdafx.h" / fo "$ (intDir) //" / fd "$ (intDir) //" / fd / gz / c bsc32 = bscmake.exe bsc32_flags = / NOLOGO /O "(outdir )/client.bsc" BSC32_sbrs = / "$ (intDir) /stdafx.sbr" / "$ (intDir) /client.sbr"
"$ (Outdir) /client.bsc": "$ (outdir)" $ (bsc32_sbrs) $ (bsc32) @ << $ (bsc32_flags) $ (bsc32_sbrs) <<
LINK32 = link.exe LINK32_FLAGS = kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32 .lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../debug/ch2_stash.lib / nologo / subsystem: console / incremental: yes / pdb: "$ (Outdir) /client.pdb" / debug / machine: i386 /out:" $(Outdir )/Client.exe "/ pdbtype: sept link32_objs = /" $ (instir) /stdafx.obj "/" $ INTDIR) /CLIENT.OBJ
"$ (Outdir) /client.exe": "$ (outdir)" $ (def_file) $ (link32_objs) $ (link32) @ << $ (link32_flags) $ (link32_objs) <
.c {$ (intdir)}. Obj :: $ (cpp) @ << $ (cpp_proj) $ <<<
.cpp {$ (intdir)} @ << $ (cpp_proj) $ <<<
.cxx {$ (intdir)} @ << $ (cpp_proj) $ <<<
.c {$ (intDir)}. Sbr :: $ (CPP) @ << $ (cpp_proj) $ <<<
.cpp {$ (intdir)}. Sbr :: $ (cpp) @ << $ (cpp_proj) $ <<<
.cxx {$ (intDir)}. Sbr :: $ (CPP) @ << $ (cpp_proj) $ <<<
! If "$ (no_external_deps)"! = "1"! If exists ("client.dep")! Include "client.dep"! Else! Message warning: Cannot Find "Client.DEP"! Endif! Endif
! If "$ (cfg)" == "Client - Win32 Release" || "$ (cfg) ==" Client - Win32 Debug "Source =. / Client.cpp
! IF "$ (cfg) ==" Client - Win32 Release "
"$ (INTDIR) /CLIENT.OBJ": $ (Source) "$ (intDir)" "$ (intDir) /client.pch"
! Elseif "$ (cfg)" == "Client - Win32 Debug"
"$ (INTDIR) /CLIENT.OBJ" "$ (intDir) /client.sbr": $ (intedu) "$ (intDir) /client.pch"
! ENDIF
Source =. / Stdafx.cpp
! IF "$ (cfg) ==" Client - Win32 Release "
CPP_Switches = / NOLOGO / ML / W3 / GX / O2 / D "WIN32" / D "NDEBUG" / D "_console" / d "_mbcs" /fp" full "/YC "stdafx.h" /YC "stdafx.h "/ Fo" $ (intDir) // "/ fd" $ (intDir) // "/ fd / c
"$ (INTDIR) /STDAFX.OBJ" "$ (intDir) /client.pch": $ (source) "$ (intDir) $ (cpp) @ << $ (cpp_switches) $ (source) <
CPP_Switches = / NOLOGO / MLD / W3 / GM / GX / ZI / OD / D "Win32" / D "_debug" / d "_console" / d "_mbCS" / fr "$ (intDir) //" / fp "$ (IntDir) /client.pch "/yc"stdafx.h" / fo "$ (intedir) //" / fd "$ (intDir) //" / fd / gz / c
"$ (INTDIR) /STDAFX.OBJ" "$ (intDir) /stdafx.sbr" "$ (intDir) /client.pch": $ (source) "$ (intDir)" $ (cpp) @ << $ ( CPP_Switches) $ (SOURCE) <<
! ENDIF
! ENDIF
[Document naming]
Traditional C uses non-distinguishable .h, .c expressed declaration and implementation. The declaration of declarations. C uses .hxx, .cxx. Now because the header file does not participate in the connection and compile (direct), use .h and. CPP