ぐぐると、VSがBOM有りUTF8でファイルを保存するけど、gccが対応していないから困ったみないな話ばっかりひっかかるけど
gccではBOM有りUTF8には2008年頃(ver. 4.1.2)対応済の模様
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33415
$ icc test_utf8_withBOM.c test_utf8_withBOM.c(1): error: unrecognized token int main(int argc, char*** argv) ^ test_utf8_withBOM.c(1): error: expected a declaration int main(int argc, char*** argv) ^ test_utf8_withBOM.c(4): warning #12: parsing restarts here after previous syntax error compilation aborted for test_utf8_withBOM.c (code 2)
手元の環境ではやっぱり駄目
でも、インテルコンパイラはGNUのcppを呼んでるはずなので4.1.2以降のcppを明示的に呼べば大丈夫!
$ icc -Qlocation,cpp,${HOME}/gcc/4.4.5/bin test_utf8_withBOM.c test_utf8_withBOM.c(1): error: unrecognized token int main(int argc, char*** argv) ^ test_utf8_withBOM.c(1): error: expected a declaration int main(int argc, char*** argv) ^ test_utf8_withBOM.c(4): warning #12: parsing restarts here after previous syntax error compilation aborted for test_utf8_withBOM.c (code 2)
と思って実験してみたけどやっぱり駄目だった。
うーむ。-Qlocationの使い方を間違ってるのか?