[cfe-users] clang+MinGW issue with float.h

Harry Wagstaff via cfe-users cfe-users at lists.llvm.org
Tue Jul 23 07:35:58 PDT 2019

Hi all,

I have a simple program which I can successfully compile with clang, using
MinGW's C/C++ Library:

#include <stdio.h>int main(int argc, char **argv) { printf("Hello
world!\n"); return 0; }

I am able to compile this with mingw-gcc successfully:

 $ gcc test.c -o test
 $ ./test
 Hello world!

I am also able to compile it successfully using clang+mingw:

 $ clang test.c -o test -target
 $ ./test
 Hello world!

However, if I make a small change to my program (include float.h), it
continues to compile with gcc but no longer compiles with clang:

#include <stdio.h>#include <float.h>int main(int argc, char **argv) {
printf("Hello world!\n"); return 0; }

 $ gcc test.c -o test
 $ ./test
 Hello world!

 $ clang test.c -o test -target x86_64-pc-windows-gnu
 In file included from test.c:2:
 In file included from C:\llvm\built\lib\clang\8.0.0\include\float.h:45:
 C:\mingw64-8.1.0\x86_64-w64-mingw32\include\float.h:28:15: fatal
error: 'float.h' file not found
 #include_next <float.h>
 1 error generated.

Is there some configuration issue with clang or some missing command line
argument? Googling around a bit, it appears that the order of paths when
including float.h is important, but this is all supposed to be handled
internally by the clang driver.


Harry Wagstaff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20190723/0a1ad535/attachment.html>

More information about the cfe-users mailing list