Building For x64 Windows using LLVM

I’m trying to do it by passing “-Xclang -m64” on the VS2019 command line options panel but it gives the error “unknown argument” on “-m64”. How do I do it? Thanks in advance.

It should work if you remove -Xclang. clang-cl will recognize -m64.

The clang -cc1 interface that clang-cl delegates to doesn’t recognize -m64. It’s implemented purely in the driver above the -cc1 invocation.

clang-cl recognizes -mllvm, so it shouldn’t need escaping.

And in general, if you find that clang-cl does not recognize a flag, I recommend prefixing it with -clang:, which causes clang to treat it as a GCC-style option in the driver instead of escaping it. The short version is, use /clang:-fblah instead of -Xclang -fblah if possible.

Okay, so I can use -std:c++17 with clang-cl.exe? I guess it was adopted from /std:c++17 which the regular cl.exe uses.

You can typically copy and paste a cl command line and it will work, and clang-cl accepts dashes or slashes, so yes

When I try to give the command /std:<C or C++ standard>, it says “ignoring unknown argument” or something along those lines. So apparently it doesn’t recognize it.

I also have a warning saying, “clang (LLVM option parsing): Unknown command line argument ‘…..\zlib\adler32.c’. Try: ‘clang (LLVM option parsing) --help’”. And then “C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.Cpp.ClangCl.Common.targets(253,5): error MSB6006: “clang-cl.exe” exited with code 1.”. I have the “Compile as” setting set to “Default” for all of the projects in the solution now and I took out the standard version specification setting as well because there are C++ and C source files there. I want to have it treat all of the source as C++ though, but I think first I need to get this issue fixed somehow.

I’m trying to use LLVM to build FLTK to LLVM bitcode so I can try building a FLTK GUI app with Emscripten. The above warning and error messages are from trying to build just fltk.vcxproj which also builds fltkzlib.vcxproj, fltkjpeg.vcxproj and fltkpng.vcxproj. These four keep failing (and there are a total of 79 projects in the solution).