I'm having problems compiling a program. Please help.

I’m not sure if this is the correct place to email for this kind of thing, but I couldn’t find any other contact info. Also, I am new to llvm, so please try to be understanding.

I keep getting an error when I try to compile a simple Hello World program (as a test)(error included below).

The error is:

Clang: warning: unable to find a Visual Studio installation; try running Clang from a developer command prompt [-Wmsvc-not-found]
hello.c:1:10: fatal error: ‘string.h’ file not found
#include <string.h>
^~~~~~~~~~
1 error generated

It looks as if Clang is looking for a Visual Studio installation for missing C library headers (string.h, stdio.h, math.h, etc.). Does Clang/llvm come with C library headers? If not, where can I get them? I don’t want to install Visual Studio because (to my understanding) it’s proprietary software. I’ve included the program I’m trying to compile (hello.c) below.

#include <string.h>
#include <stdio.h>
int main(void){
print(“Hello World!”);
return 0;
}

AFAIK You have to install Windows 10 SDK which comes with Visual Studio. Clang itself doesn’t provide headers.

But I dont know anything about Windows so I could be very wrong here

Zhang

You need to install Visual Studio for headers and libraries. It’s possible to make clang work with LLVM’s C++ standard library (libc++), but it is not trivial, and that still won’t get you a C Runtime Library. Note that while Visual Studio is proprietary software, Visual Studio Community Edition has a quite permissive license.

https://visualstudio.microsoft.com/dev-essentials/

Visual Studio comes with a batch file vcvarsall.bat that sets the
environment variables containing the paths to headers and libraries.
You can select the environment from the start menu, e.g. "Developer
Command Prompt for VS 2019" or "x64_x86 Cross Tools Command Prompt for
VS 2017".

Michael