[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Clang c++ include path
From: |
Mathieu Othacehe |
Subject: |
Clang c++ include path |
Date: |
Mon, 28 Oct 2019 09:19:23 +0100 |
Message-ID: <address@hidden>
User-agent: mu4e 1.2.0; emacs 26.3
https://issues.guix.info/issue/32773,
mathieu@meru:~/tmp$ ~/.guix-profile/bin/clang t.cpp
t.cpp:1:10: fatal error: 'string' file not found
mathieu@meru:~/tmp$ ~/.guix-profile/bin/clang -v t.cpp
t.cpp:1:10: fatal error: 'string' file not found
mathieu@meru:~/tmp$ ~/.guix-profile/bin/g++ -v t.cpp
Hello,
When running clang on a c++ program, it cannot find c++ std libraries.
That's because, those libraries path are hardcoded inside g++ compiler
and clang cannot find them.
This has already been discussed here:
without reaching a solution.
Running this program,
--8<---------------cut here---------------start------------->8---
#include <string>
int main()
{
return 0;
}
--8<---------------cut here---------------end--------------->8---
I have this error:
--8<---------------cut here---------------start------------->8---
#include <string>
^~~~~~~~
1 error generated.
--8<---------------cut here---------------end--------------->8---
that's because:
--8<---------------cut here---------------start------------->8---
...
#include "..." search starts here:
#include <...> search starts here:
/gnu/store/933ijsm5wwjkvlh963lc3pxc7i3dfxcp-profile/include
/gnu/store/i2vzqb02gxcm5c2zix92lq3ay73kbl9s-clang-8.0.0/lib/clang/8.0.0/include
/gnu/store/ahqgl4h89xqj695lgqvsaf6zh2nhy4pj-glibc-2.29/include
End of search list.
#include <string>
^~~~~~~~
1 error generated.
--8<---------------cut here---------------end--------------->8---
whereas,
--8<---------------cut here---------------start------------->8---
...
#include "..." search starts here:
#include <...> search starts here:
/gnu/store/933ijsm5wwjkvlh963lc3pxc7i3dfxcp-profile/include
/gnu/store/x3jx25cd3q363mr7nbgzrhrv1vza6cf7-gcc-7.4.0/include/c++ [1]
/gnu/store/x3jx25cd3q363mr7nbgzrhrv1vza6cf7-gcc-7.4.0/include/c++/x86_64-unknown-linux-gnu
[2]
/gnu/store/x3jx25cd3q363mr7nbgzrhrv1vza6cf7-gcc-7.4.0/include/c++/backward [3]
/gnu/store/2plcy91lypnbbysb18ymnhaw3zwk8pg1-gcc-7.4.0-lib/lib/gcc/x86_64-unknown-linux-gnu/7.4.0/include
/gnu/store/2plcy91lypnbbysb18ymnhaw3zwk8pg1-gcc-7.4.0-lib/lib/gcc/x86_64-unknown-linux-gnu/7.4.0/include-fixed
/gnu/store/ahqgl4h89xqj695lgqvsaf6zh2nhy4pj-glibc-2.29/include
...
--8<---------------cut here---------------end--------------->8---
Hardcoding the paths [1], [2] and [3] into clang would solve the
issue, but it might not be the better way to proceed. WDYT?
Mathieu
- Clang c++ include path,
Mathieu Othacehe <=