clang

clang: warning: no such sysroot directory: '-mmacosx-version-min=10.5' on compiling LLVM (3.9.0)

我与影子孤独终老i 提交于 2020-07-19 18:55:51
问题 I am compiling LLVM (3.9.0) using CMake (3.6.2) on my Mac (OsX) using GCC, but somehow I am getting the following error with following GCC configuration Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 7.3.0 (clang-703.0.31) Target: x86_64-apple-darwin15.6.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin [50%] Building C object projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt

clang: warning: no such sysroot directory: '-mmacosx-version-min=10.5' on compiling LLVM (3.9.0)

你。 提交于 2020-07-19 18:54:30
问题 I am compiling LLVM (3.9.0) using CMake (3.6.2) on my Mac (OsX) using GCC, but somehow I am getting the following error with following GCC configuration Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 7.3.0 (clang-703.0.31) Target: x86_64-apple-darwin15.6.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin [50%] Building C object projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt

Setting C compile flags in xcode

自闭症网瘾萝莉.ら 提交于 2020-07-19 11:17:59
问题 I've been trying to compile some C files to use in XCode that uses Openssl as a dependency for encryption. When compiling with clang the code compiles fine. I read a few posts on here like Setting C++ compile flags in xcode that says to put the flags under Other Linker Flags but I still couldn't get it to recognize it. Here is the compiling command that works on the command line: Flags in XCode: The error in XCode: 回答1: Solution thanks to @WhozCraig Add the include folder in "Header Search

Setting C compile flags in xcode

烈酒焚心 提交于 2020-07-19 11:17:08
问题 I've been trying to compile some C files to use in XCode that uses Openssl as a dependency for encryption. When compiling with clang the code compiles fine. I read a few posts on here like Setting C++ compile flags in xcode that says to put the flags under Other Linker Flags but I still couldn't get it to recognize it. Here is the compiling command that works on the command line: Flags in XCode: The error in XCode: 回答1: Solution thanks to @WhozCraig Add the include folder in "Header Search

Clang vs G++ lvalue to rvalue conversion

旧城冷巷雨未停 提交于 2020-07-09 11:55:56
问题 The question related to this one. By tracing slt_pair. h and move. h , it's seems that the difference between Clang and G++ is internally. I have tried to simulate the assignment of the object (pair.first) as same as the implementation of std_pair.h , the output is same as Clang output it's reasonable output, but why when using pairs it's changes. #include <iostream> struct Foo { Foo() { std::cout << "default" << std::endl; } Foo(Foo& f2) { std::cout << "non-const" << std::endl; } Foo(const

Using cout in the constructor of a class that is included in another class as a static member

杀马特。学长 韩版系。学妹 提交于 2020-07-06 10:52:13
问题 Following code #include <iostream> struct A { A() { std::cout << std::endl; } }; struct B { static inline A a; }; int main() { } succeeds after compiling with gcc, but crashes with segmentation fault after compiling with clang. Is the code not standard or is clang wrong? https://godbolt.org/z/tEvfrW 回答1: Cppreference on std::ios_base::Init reads: The header <iostream> behaves as if it defines (directly or indirectly) an instance of std::ios_base::Init with static storage duration: this makes

Why does the buffering of std::ifstream “break” std::getline when using LLVM?

对着背影说爱祢 提交于 2020-07-06 07:04:23
问题 I have a simple C++ application which is supposed to read lines from a POSIX named pipe: #include<iostream> #include<string> #include<fstream> int main() { std::ifstream pipe; pipe.open("in"); std::string line; while (true) { std::getline(pipe, line); if (pipe.eof()) { break; } std::cout << line << std::endl; } } Steps: I create a named pipe: mkfifo in . I compile & run the C++ code using g++ -std=c++11 test.cpp && ./a.out . I feed data to the in pipe: sleep infinity > in & # keep pipe open,

What does the CodeModel in Clang / LLVM refer to?

喜夏-厌秋 提交于 2020-07-03 03:16:08
问题 I have been looking through the Clang / LLVM source-code and I came across the CodeModel property of CodeGenOptions. Based on this method, the valid values appear to be: "small" , "kernel" , "medium" and "large" . What do this property control? How do I go about choosing the correct value for my application? 回答1: Code model is a term from AMD64 ABI (see 3.5.1 from https://software.intel.com/sites/default/files/article/402129/mpx-linux64-abi.pdf for more information). In short - the majority

How can I find all Clang versions installed on my Mac?

回眸只為那壹抹淺笑 提交于 2020-06-29 04:49:15
问题 clang --version Apple LLVM version 10.0.0 (clang-1000.10.44.4) Target: x86_64-apple-darwin17.7.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin which clang /usr/bin/clang I'm on Mac, 10.13.6, any instructions would be appreciated! 回答1: You can use which -a clang to list all of the clang s on your PATH . Ones which aren't on your PATH , like if you've installed Clang somewhere out of the ordinary, won't be shown. A complication is that /usr/bin/clang is actually

Qt How do I remove Clang Code Model?

↘锁芯ラ 提交于 2020-06-27 08:57:05
问题 I started using Qt a couple months ago. It's been fine and easy to use. Last night I updated it and something messed everything up. I could not run qmake nor figure out how to fix it. So I uninstalled and reinstalled it. Now it is using the Clang model. I'm not sure if it was before but I don't think it was. Now the autocomplete is messed up. When creating the definition of a function in a .cpp file, the autocomplete won't fill in the parameters like it used to. Also, sometimes type names