
크로스컴파일을 위해 cygwin32에서 mingw32를 사용하려고 합니다. 그러나 float.h와 관련된 오류가 발생합니다.
In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/winnt.h:16:0,
from /usr/i686-w64-mingw32/sys-root/mingw/include/minwindef.h:146,
from /usr/i686-w64-mingw32/sys-root/mingw/include/windef.h:8,
from /usr/i686-w64-mingw32/sys-root/mingw/include/windows.h:69,
from globals.h:17,
from globals.c:10:
/usr/i686-w64-mingw32/sys-root/mingw/include/float.h:278:57: error: expected ‘;’, ‘,’ or ‘)’ before numeric constant
_CRTIMP double __cdecl __MINGW_NOTHROW _chgsign (double _X);
여기에서 비슷한 문제가 있는 기사를 찾았습니다.
https://www.cygwin.com/ml/cygwin/2003-07/msg00525.html
그리고 그들은 mingw float.h가 gcc float.h보다 먼저 발견되도록 포함 순서를 변경할 것을 제안했습니다.
그러나 다음과 같이 헤더를 수동으로 포함하려고 하면 다음과 같습니다.
i686-w64-mingw32-gcc -DHAVE_CONFIG_H -I /cygdrive/d/Cygwin32/usr/i686-w64-mingw32/sys-root/mingw/include
verbose 옵션을 사용하면 "is는 시스템 디렉터리와 중복되는 비시스템 디렉터리입니다"라는 이유로 포함이 무시되었다는 메시지가 표시됩니다.
내 생각에는 i686-w64-mingw32-gcc를 호출하면 mingw 라이브러리와 cygwin용 소스를 설치한 경우 자동으로 해당 디렉토리가 포함됩니다.
컴파일러의 자세한 출력에서 포함 순서대로 문제를 명확하게 볼 수 있습니다.
/usr/lib/gcc/i686-w64-mingw32/4.8.3/include
/usr/lib/gcc/i686-w64-mingw32/4.8.3/include-fixed
/usr/i686-w64-mingw32/sys-root/mingw/include
하지만 mingw include를 gcc include 앞으로 어떻게 이동합니까?
답변1
gcc 플래그 -nostdinc를 사용한 다음 포함 순서를 재정의할 수 있다는 것을 알아냈습니다.
이전 Google 검색에서 왜 찾지 못했는지 모르겠습니다.