How to force Eclipse CDT to use only libc++? [message #1800410] |
Thu, 27 December 2018 03:22  |
Eclipse User |
|
|
|
I've been trying to use clang with libc++ in an Eclipse CDT project, but every time I add "c++" and delete "stdc++" in
Project->Properties->C/C++ Build->Settings->Tool Settings->LLVM Clang C++ Linker->Libraries
"stdc++" gets re-inserted, and both libraries get linked.
Using the flag "-stdlib=libc++" still ends up with Eclipse linking to "stdc++".
How do I get Eclipse to use only libc++?
[Updated on: Thu, 27 December 2018 10:44] by Moderator
|
|
|
|
|
Re: How to force Eclipse CDT to use only libc++? [message #1802431 is a reply to message #1800638] |
Fri, 08 February 2019 12:45  |
Eclipse User |
|
|
|
I've found a solution, which in retrospect seems so very, very obvious.
When creating a project and choosing LLVM/clang as the toolchain, I went to the compiler settings Project -> Properties -> C/C++ Build -> Settings -> LLVM Clang++
and appended
to the "Command" field.
I also added "c++" to be included by the linker:
Project -> Properties -> C/C++ Build -> Settings -> LLVM Clang C++ Linker -> Libraries (-l)
The presence of the "stdc++" library can be safely ignored.
To test if "libc++" is really used, I've written the following piece of code:
#include <iostream>
int main() {
std::cout << _LIBCPP_VERSION << std::endl;
return 0;
}
In my case, the output was
which corresponds to clang 7.0 on my system.
Edit:
Update: I mistakenly typed "-std" instead of "-stdlib".
[Updated on: Wed, 13 February 2019 11:26] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.03678 seconds