Clang says: "cstdlib file not found"

With an almost standard installation of Ubuntu 11.04, I installed clang.

I am trying to compile this:

#include <cstdlib> int main(){ return 0; } 

g ++ can handle this just fine, but clang ++ errors: fatal error: cstdlib file not found

Can someone explain why this is happening? and what needs to be done to make this work? I expected clang ++ to become a replacement for g ++.

+4
source share
1 answer

It looks like your clang assembly is not looking for the right platform, including paths. Try checking with

 clang -v ... 

where it searches for headers (and check that your platform includes paths). You may need to add additional include directories (e.g. / usr / include / C ++ / xy).

You might want to take a look at the source file lib/Frontend/InitHeaderSearch.cpp , the AddDefaultCPlusPlusIncludePaths method executes a specific distribution / gcc version of the magic (I had to fix it for my own system once).

+5
source

All Articles