1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

clang cross compile では case-sensitive file system では大文字小文字を区別しないヘッダを読み込めない

Posted at

背景

llvm-mingw で Windows アプリを cross-compile したい.

しかし, case-sensitive なファイルシステム(e.g. Ubuntu 18.04 + EXT4)では, #include <Windows.h> はエラーになる.
(mingw パッケージではヘッダ名はすべて小文字になっているため).

clang

で case insensitive にするパッチがあるが(2016 年!) 取り込まれていない

clang-cl

clang-cl(MSVC に擬態するモード)は, しかし case-sensitive であるのを想定しており, #include <windows.h> とすると nonportable-include-path warning がでる.

まとめ

#ifdef _WIN32
#ifdef __MINGW32__ // mingw gcc, llvm-mingw(clang)
#include <windows.h>
#else // MSVC, clang-cl
#include <Windows.h>
#endif
#endif

とりあえずはソースコードにこのように記述して対応するしかない.

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?