Visual C++ ver.6 で Visual C++ ToolKit 2003を使う

Copyright(c) Yamada,K 2004/11/21



 米マイクロソフトは、2004年4月にVisual C++のコマンドライン・コンパイラの無償提供を
始めました。「Visual C++ Toolkit 2003」というもので、これはVisual Studio .NET 2003
Professional 版に含まれるものと同じ最適化コンパイラです。対応するOSはWindows 2000/XP、
Windows Server 2003です。
 これで無料で Visual C++ をコマンドラインで利用できるようになりましたが、教科書的な
C/C++プログラミングは出来ますが、Windowsプログラムを書くためのライブラリは含まれてい
ません。
 ただし、Visual C++ ver.6 との下位互換性はありますので、ver.6 を使っている人は、最新
の最適化コンパイラ(ver.7)に置き換えて ver.6 のライブラリがそのまま使えます。


【Visual C++ Toolkit 2003の場所】
 Visual C++ Toolkit 2003は以下の場所にあります。 リンク「Download the Visual C++ Toolkit 2003」から、ダウンロード・ページへ移ります。 右側にある「 Download 」をクリックするとダウンロードできます。
[補足] 以前は「Download the Visual C++ Toolkit 2003」をクリックして ダウンロード出来ましたが、今見ると登録が必要になっている様です。
【Visual C++ Toolkit 2003のインストール】
 ファイルをダブルクリックすると、インストーラが起動します(起動までには時間がかかります)。 インストールが完了すると、スタートメニューに「Visual C++ Toolkit 2003 Command Prompt」が 登録されます。 コマンドプロンプト 「Visual C++ Toolkit 2003 Command Prompt」を実行すると、コマンドプロンプトが次のように 開きます。
Setting environment for using Microsoft Visual C++ 2003 Toolkit.
(If you have another version of Visual Studio or Visual C++ installed and wish
to use its tools from the command line, run vcvars32.bat for that version.)

Thank you for choosing the Visual C++ Toolkit 2003!  Get started quickly by
building the code samples included in the "Samples" directory.  Each sample
includes a short whitepaper discussing the Visual C++ features, and a batch
file for building the code.

Type "cl /?" for brief documentation on compiler options.

Visit http://msdn.microsoft.com/visualc/using/documentation/default.aspx for
complete compiler documentation.

C:\Program Files\Microsoft Visual C++ Toolkit 2003>
 デフォルトではカレント・ディレクトリは、インストールされた場所になります。ディレクト リを移動するには、cd コマンドを使います。例えば、プログラムがディレクトリ(フォルダ) c:\Source にある場合「cd c:\source」と実行します。
C:\Program Files\Microsoft Visual C++ Toolkit 2003>cd c:\source             

C:\Source>                                                                  
 コンパイラは Visual C++ ver.6 と同じ cl.exe です。例えば、ソース・プログラムが test.cpp の場合次のように、コンパイル/リンクします。
C:\Source>cl test.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86 
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.

test.cpp
Microsoft (R) Incremental Linker Version 7.10.3077
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:test.exe
test.obj

C:\Source>
このコマンドプロンプトでは、コンパイラ・リンカやCランタイムライブラリ、C++標準ライブラリ が Visual C++ .NET のものに置き換わり(つまり呼び出しが優先されて)、それ以外のライブラリ Windows API関数 等はver.6 のものが使えます。  後は使いやすいように、プロパティの設定を変更します。スタートメニューから「Visual C++ Toolkit 2003 Command Prompt」でマウスを右クリックして、プロパティを開きます。 プロパティ  「ショートカット」タブにある「作業フォルダ」をソース・プログラムを保存するディレクトリ (フォルダ)に、例えば c:\source などに変更するといいでしょう。

| 戻る |

Copyright(c) 2004 Yamada, K