创建项目

类别:编程语言 点击:0 评论:0 推荐:

2.3 创建项目

   【MAKE文件】
     make工具提供了各个处理模块的比较批处理的编译功能, 需要一个makefile表示项目中的模块各自的关系. 现在的VC已经不需要我们关心这些细节, 而且甚至不需要使用它们.

     还是COM, 如果你需要产生一个proxy/stub的代理控件, 就需要使用到make和makefile
 nmake -nf projectnamePS.mk

     上面例子的makefile( 使用VC的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"$(INTDIR)\client.pch" /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= \
  "$(INTDIR)\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
 INTDIR=.\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= \
  "$(INTDIR)\StdAfx.obj" \
  "$(INTDIR)\client.obj"

 "$(OUTDIR)\client.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
     $(LINK32) @<<
   $(LINK32_FLAGS) $(LINK32_OBJS)
 <<

 !ENDIF

 .c{$(INTDIR)}.obj::
    $(CPP) @<<
    $(CPP_PROJ) $<
 <<

 .cpp{$(INTDIR)}.obj::
    $(CPP) @<<
    $(CPP_PROJ) $<
 <<

 .cxx{$(INTDIR)}.obj::
    $(CPP) @<<
    $(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" : $(SOURCE) "$(INTDIR)" "$(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"$(INTDIR)\client.pch" /Yc"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c

 "$(INTDIR)\StdAfx.obj" "$(INTDIR)\client.pch" : $(SOURCE) "$(INTDIR)"
  $(CPP) @<<
   $(CPP_SWITCHES) $(SOURCE)
 <<


 !ELSEIF  "$(CFG)" == "client - Win32 Debug"

 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"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ  /c

 "$(INTDIR)\StdAfx.obj" "$(INTDIR)\StdAfx.sbr" "$(INTDIR)\client.pch" : $(SOURCE) "$(INTDIR)"
  $(CPP) @<<
   $(CPP_SWITCHES) $(SOURCE)
 <<


 !ENDIF


 !ENDIF

   【文件命名】

     . 传统C使用不区分大小的.h, .c表示声明和实现
     . Unix下开始区分大小
     . C++使用.hxx, .cxx
     . 现在因为头文件不参与连接和编译( 直接 ), 使用.h和.cpp

本文地址:http://com.8s8s.com/it/it27953.htm