2

When using clang++ to build a simple hello world application, clang can't find standard library files. Should I point clang to arm-none-eabi for those files?

I'm using the clang binary downloaded from the llvm website.

#include <stdio.h>

int main(void)
{
    printf("Hello World");
    return 0;
}

Build Command: clang++ -c -target arm-none-eabi -mcpu=cortex-m4 main.cpp

The above fails to locate stdio.h

Ultimately I'm going to be doing all of this using cmake on both windows and linux but I figure baby steps...

BLowe
  • 306
  • 1
  • 11
  • Try including `` instead and see what happens. –  Sep 11 '19 at 17:37
  • Where are those STL files? Are you sure they are somewhere in standard path? – SergeyA Sep 11 '19 at 17:40
  • [A useful question](https://stackoverflow.com/q/48369566/10957435), [another useful question](https://stackoverflow.com/q/39968458/10957435), and a [related quora question](https://www.quora.com/Why-does-llvm-clang-does-not-have-stdio-h-in-its-headers-in-Windows-Why-does-it-import-stdio-h-from-mingw-include-Doesnt-llvm-clang-support-Windows). –  Sep 11 '19 at 17:45
  • No, I'm not sure they are in a path. It looks like arm-non-eabi-gcc has an include directory that has a bunch of standard header files. The problem is that there are multiple copies of some files (with slight variations) in subdirectories. Directories are named in a way that make me think that the flags that get passed to GCC are what chooses the include directories (hard vs soft float being an example). I am trying to go through and include things that look right but it's not super intuitive. Does this sound like the right process for arm/clang development? – BLowe Sep 12 '19 at 14:06

0 Answers0