clang/clang++ doesn't find C/C++ headers in windows?

前端 未结 3 1425
终归单人心
终归单人心 2020-12-16 14:23

1 hour ago I downloaded llvm-3.6.0-rc4-win32.exe from http://llvm.org/pre-releases/3.6.0/ .

I tried to compile simple C code that just print \"hello\" , but it didn\

相关标签:
3条回答
  • 2020-12-16 14:39

    The current method to do it is...

    • Install mingw-w64-install.exe (currently 7.2.0, make sure to set "i686" to "x86_64" when asked)
    • Install Clang for Windows (64-bit) (currently 5.0.0)

    When asked, default paths. Place them both in your system path (accessible for all users). The Clang installer will put clang in the path if you ask it to, for Mingw, you have to do it manually, I recommend PathEditor2. For the current version of Mingw, the directory to add to your path is C:\Program Files\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev0\mingw64\bin

    Then when invoking Clang, use...

    clang -target x86_64-pc-windows-gnu test.c -otest.exe
    

    Clang will search your path to find the Mingw headers and libraries, make sure you only have one version in your path.

    0 讨论(0)
  • 2020-12-16 14:40

    Try this one

    Installing Clang 3.5 for Windows.

    Regards.

    0 讨论(0)
  • 2020-12-16 14:47

    We attempted to run the test of Clang as described in llvm.org/docs/GettingStartedVS.html. That procedure failed for similar reasons indicating that stdio.h was not found. Attempting installation on another machine it was successful. We ran a few verbose runs to identify the difference between the machines using "-v" flag for a verbose description of the linking process.

    We found that the working installation had the default mapping of Windows System32 directory (C:\Windows\System32) in the path variables. The failing machine did not have that path mapped. We added the path to the failing machine and everything worked.

    This may have been a change implemented by system administrators for security reasons. If adding the path is not allowed, add “-isystem C:\file\location\here” to the clang command for each file you wish to include.

    0 讨论(0)
提交回复
热议问题