あるC++プログラムをMinGWのGCCでコンパイルしようとしたら、吐き気がする程の大量のエラーメッセージが表示された。いやいやエラーになるにしてもこの量は有り得ないわ。何かが悪さしてるんじゃないか。
で、試しに超簡単なコード書いてコンパイルしてみようとしたらコケる。
> type test.cpp #include <iostream> int main(int argc, char *argv[]) { std::cout << "hello" << std::endl; return 0; } > gcc test.cpp C:/Program Files/Haskell Platform/2012.4.0.0/mingw/bin/ld.exe: cannot open outpu t file a.exe: Permission denied collect2: ld returned 1 exit status > g++ test.cpp Info: resolving std::cout by linking to __imp___ZSt4cout (auto-import) c:/program files/haskell platform/2012.4.0.0/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/ld.exe: warning: auto-importing has been activated without --enable-auto-import specified on the command line. This should work unless it involves constant data structures referencing symbols from auto-imported DLLs.
MinGWなのに何故か "Haskell Platform" の文字が。
> PATH PATH=C:\Program Files\Haskell\bin;C:\Program Files\Haskell Platform\2012.4.0.0\lib\extralibs\bin;C:\Program Files\Haskell Platform\2012.4.0.0\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Haskell Platform\2012.4.0.0\mingw\bin;C:\Documents and Settings\AmaiSaeta\bin\mingw\bin;C:\Documents and Settings\AmaiSaeta\bin\mingw\msys\1.0\bin
"C:\Document and Settings\AmaiSaeta\bin\mingw" 以下がMinGWのインストール先。
成る程、GHCは内部にMinGW環境持ってて、それと競合してると。
しかしこれはどうした物だろう。MinGW関係のディレクトリをGHCのディレクトリより先に持ってくると、今度はGHC周りでトラブるのが目に見えてるし。GHC関係、またはMinGW関係のPATH設定をバッチファイルに抜き出して、必要になる直前に実行するというのは、流石にメンドクサイので避けたいんだけどなぁ。
というか、GHCがMinGWを内部に抱えてるのに吃驚。