MS cl を使用してコマンドラインでこのコマンドを実行すると:
cl -c /W3 /Od ioapi.c
オブジェクト ファイル ioapi.obj が期待どおりに作成されます。
ただし、このエントリでメイクファイルを作成すると:
ioapi.obj: ioapi.c
cl -c /W3 /Od ioapi.c
上のclの前にタブがあります
make ioapi.obj を実行すると、次のエラーが発生します。
make ioapi.obj
cl -c /W3 /Od ioapi.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.21022.08 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
cl : Command line warning D9024 : unrecognized source file type 'C:/MinGW/msys/1.0/W3', object file assumed
cl : Command line warning D9027 : source file 'C:/MinGW/msys/1.0/W3' ignored
cl : Command line warning D9024 : unrecognized source file type 'C:/MinGW/msys/1.0/Od', object file assumed
cl : Command line warning D9027 : source file 'C:/MinGW/msys/1.0/Od' ignored
ioapi.c
cl : Command line warning D9024 : unrecognized source file type 'C:/MinGW/msys/1.0/W3', object file assumed
cl は MS VS 2008 コンパイラです。
minGW をインストールしました。バージョンは 6 か月前のものです。
make -n ioapi.c を実行すると、これが期待どおりに報告されます。
cl -c /W3 /Od ioapi.c
Visual Studio 2008 コマンド プロンプトから cl.exe を実行しています (VS2008 環境変数が事前に設定されています)。
この奇妙なエラーが発生する理由とその修正方法を教えてください。
MSの環境に問題があるのだろうか。しかし、make を実行する前に vcvars32.bat ファイルを実行して MS 環境をセットアップしても、違いはありません。
これを使用すると、次のことに気付きました。
ioapi.obj: ioapi.c
cl -c ioapi.c
その後、エラーはなくなります。ただし、コンパイラ スイッチを渡す必要があります。