=> http://www.winprog.org/tutorial/msvc.html

Getting Them
Microsoft has quietly released it's command line compiler and linker tools as part of the .NET Framework SDK. The Framework SDK comes with everything you need to for .NET development (C# compiler etc...) including the command line compiler cl.exe which, while it's intended for use with the .NET framework, is the same compiler that comes with Visual C++ Standard.

.NET Framework SDK (Requires Windows XP or 2000)

Since this is the .NET SDK, it doesn't come with the headers and libraries required for Win32 API development, as these are part of the Platform SDK. Lo and behold, the Platform SDK is free as well. You only need the Core SDK, but feel free to download the other components as you desire.

Platform SDK

As a bonus, if you download the Platform SDK documentation (which I highly recommend) you will have a complete local and up to date Win32 reference which is MUCH easier to use than MSDN online.

Remember to check the options to Register Environment Variables in both SDKs, otherwise you'll need to set up the PATH and other variables yourself before the tools will work from the command line.
Using Them
Since comprehensive documentation is provided, and also accessable at MSDN online, you'll need to RTFM yourself to learn about the VC++ compiler and tools. To get you started, here are the most basic ways to build a program...

To build a simple console application:

cl foo.c

To build a simple windows application such as the examples on this tutorial:

rc dlg_one.rc
cl dlg_one.c dlg_one.res user32.lib



==> unknow

# 以上要先安裝Platform SDK和.NET Framework SDK
# 接下來要做環境變數的設定

●以 Visual C++ 為例

以 Visual C++ 為例,如果安裝後的檔案布局如下:

C:\MSDEV\VC98\BIN : 這裡放有編譯器 CL.EXE
C:\MSDEV\VC98\INCLUDE 這裡放有 C/C++ header files
C:\MSDEV\VC98\LIB 這裡放有 C/C++ standard libraries

那麼你可以寫一個批次檔如下:

set PATH=C:\MSDEV\VC98\BIN;C:\MSDEV\COMMON\MSDEV98\BIN
set INCLUDE=C:\MSDEV\VC98\INCLUDE
set LIB=C:\MSDEV\VC98\LIB

之所以需要另外設定 PATH=C:\MSDEV\COMMON\MSDEV98\BIN,是因為編譯器 CL.EXE 執時需要 MSPDB60.DLL,而它被安裝於 C:\MSDEV\COMMON\MSDEV98\BIN 之中。

如果你寫的程式不只是單純的 C/C++ 程式,還用到了 MFC,一樣可以在 console mode 下編譯,這時候你的環境變數應該如此設定:

set PATH=C:\MSDEV\VC98\BIN;C:\MSDEV\COMMON\MSDEV98\BIN
set INCLUDE=C:\MSDEV\VC98\INCLUDE;C:\MSDEV\VC98\MFC\INCLUDE
set LIB=C:\MSDEV\VC98\LIB;C:\MSDEV\VC98\MFC\LIB

多指定了 MFCINCLUDE 和 MFCLIB,就可以讓編譯器和聯結器找到 MFC 的 header files 和 libraries。如果你還需要用到 ATL,就得在 INCLUDE 環境變數中再加上 C:\MSDEV\VC98\ATL\INCLUDE。

====> 在使用cl.exe之前,請先用cmd執行這個檔案,然後繼續compile

cd C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\tools
vsvars32.bat

====> 在使用cl.exe之前,要做這個動作,我己寫成BAT檔案,這個是參考用

REM 會用到cl.exe的程式們,使用之前都要先執行這支程式
REM Update: 96-12-27
REM
set VC=C:\Program Files\Microsoft Visual Studio .NET 2003
set PATH=%PATH%;%VC%\Vc7\bin;%VC%\Common7\IDE
set INCLUDE=%INCLUDE%;%VC%\Vc7\include
set LIB=%LIB%;%VC%\Vc7\lib

====> 又一篇perlwin32的文章,要compile perl for windows用的

http://perldoc.perl.org/perlwin32.html


arrow
arrow
    全站熱搜
    創作者介紹
    創作者 付爸爸 的頭像
    付爸爸

    付爸爸的神奇日記本

    付爸爸 發表在 痞客邦 留言(0) 人氣()