[cfe-users] Standard headers cannot be found when compiling with Clang

Qiuping Yi via cfe-users cfe-users at lists.llvm.org
Sun Jan 17 19:19:51 PST 2016


I cannot solve this problem by all the methods I know. I don't know why.
Now I just reinstall llvm and clang, and it wokrs.
Thanks for your help!


--------------------------------------------
Qiuping Yi
Institute Of Software
Chinese Academy of Sciences

On Sat, Jan 16, 2016 at 1:39 PM, Matthew Brush via cfe-users <
cfe-users at lists.llvm.org> wrote:

> On 2016-01-15 8:36 PM, Qiuping Yi via cfe-users wrote:
>
>> I use ubuntu,
>>
>>
> I don't think Clang ever could find proper includes here. See the bugs
> like:
>
> https://bugs.launchpad.net/ubuntu/+source/llvm-defaults/+bug/1242300
>
> It works fine, it just doesn't know where to find the correct stdlib
> headers, so you have to use an -I argument to tell it where your stdlib
> headers are (arch-specific on Debians/Ubuntus/etc).
>
> Cheers,
> Matthew Brush
>
> $ uname -a
>> Linux novice 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17:39:31
>> UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
>>
>> and this is the output of 'clang -v -c'
>>
>> $ clang -v -c test.c
>> clang version 3.6.0 (tags/RELEASE_360/final)
>> Target: x86_64-unknown-linux-gnu
>> Thread model: posix
>>   "/home/novice/installed/llvm-3.6.0.src/Release+Asserts/bin/clang" -cc1
>> -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
>> -main-file-name t1.c -mrelocation-model static -mthread-model posix
>> -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases
>> -munwind-tables -target-cpu x86-64 -v -dwarf-column-info -coverage-file
>> /home/novice/installed/llvm-3.6.0.src/Release+Asserts/bin/t1.c
>> -resource-dir
>>
>> "/home/novice/installed/llvm-3.6.0.src/Release+Asserts/bin/\${CLANG_RESOURCE_DIR}"
>> -isysroot "\${DEFAULT_SYSROOT}" -c-isystem /home/novice/.install/include
>> -cxx-isystem /home/novice/.install/include -internal-isystem
>> "\${DEFAULT_SYSROOT}/usr/local/include" -internal-isystem
>>
>> "/home/novice/installed/llvm-3.6.0.src/Release+Asserts/bin/\${CLANG_RESOURCE_DIR}/include"
>> -internal-externc-isystem "\${C_INCLUDE_DIRS}" -fdebug-compilation-dir
>> /home/novice/installed/llvm-3.6.0.src/Release+Asserts/bin -ferror-limit 19
>> -fmessage-length 205 -mstackrealign -fobjc-runtime=gcc
>> -fdiagnostics-show-option -fcolor-diagnostics -o t1.o -x c
>> /home/novice/installed/llvm-3.2.src/examples/test/t1.c
>> clang -cc1 version 3.6.0 based upon ${BACKEND_PACKAGE_STRING} default
>> target x86_64-unknown-linux-gnu
>> ignoring nonexistent directory "/home/novice/.install/include"
>> ignoring nonexistent directory "/home/novice/.install/include"
>> ignoring nonexistent directory "${DEFAULT_SYSROOT}/usr/local/include"
>> ignoring nonexistent directory
>>
>> "/home/novice/installed/llvm-3.6.0.src/Release+Asserts/bin/${CLANG_RESOURCE_DIR}/include"
>> ignoring nonexistent directory "${C_INCLUDE_DIRS}"
>> #include "..." search starts here:
>> End of search list.
>> /home/novice/installed/llvm-3.2.src/examples/test/t1.c:2:10: fatal error:
>> 'stdio.h' file not found
>> #include <stdio.h>
>>           ^
>> 1 error generated.
>>
>> I put clang in llvm-3.6.0.src/toos/...
>>
>>
>> --------------------------------------------
>> Qiuping Yi
>> Institute Of Software
>> Chinese Academy of Sciences
>>
>> On Sat, Jan 16, 2016 at 12:56 AM, Hans Wennborg <hans at chromium.org>
>> wrote:
>>
>> On Fri, Jan 15, 2016 at 7:06 AM, Qiuping Yi via cfe-users
>>> <cfe-users at lists.llvm.org> wrote:
>>>
>>>> Hello All,
>>>>
>>>> I am a beginner of clang. I installed clang 3.6 with llvm 3.6, but I
>>>>
>>> found
>>>
>>>> my clang cannot work as expected.
>>>> For the next simple program test.c:
>>>>
>>>> #include <stdio.h>
>>>> int main() {return 0;}
>>>>
>>>> $ clang -c test.c
>>>>
>>>> I got the next information:
>>>>
>>>> fatal error: 'stdio.h' file not found
>>>> #include <stdio.h>
>>>>               ^
>>>> 1 error generated.
>>>>
>>>> what's wrong? I found other standard headers are also cannot be found.
>>>> Any suggestion is OK. Thank you in advance.
>>>>
>>>
>>> What operating system are you using?
>>>
>>> What's the output of "clang -v -c test.c"?
>>>
>>>  From where did you install clang?
>>>
>>>
>>
>>
>> _______________________________________________
>> cfe-users mailing list
>> cfe-users at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
>>
>>
> _______________________________________________
> cfe-users mailing list
> cfe-users at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20160118/4d9bf1ce/attachment.html>


More information about the cfe-users mailing list