草庐IT

clang_complete

全部标签

c++ - 我需要什么工具链来交叉编译 Clang for iOS

好的,首先我知道这可以在iOS(armv7)上编译,因为我阅读了文档。但是,我找不到合适的工具链。那么,现在,我已经尝试过哪些工具链:i686-apple-darwin10-cpp-4.2.1i686-apple-darwin10-g++-4.2.1i686-apple-darwin10-gcc-4.2.1以上交叉编译为x86(我在i386上)。工作正常。但我不需要它arm-apple-darwin10-cpp-4.2.1arm-apple-darwin10-g++-4.2.1arm-apple-darwin10-gcc-4.2.1上面的编译很好,但没有像我预期的那样交叉编译到arm,

c++ - 我可以使用较新的 gcc/clang 来定位较旧的 linux 吗? C++

现在我使用提供的gcc在某个旧版本的linux(SLED10)上编译我的C++软件,它可以在大多数新版本上运行,因为它们具有更新的glibc。问题是,旧的gcc不支持C++11,我真的很想使用新功能。现在我有了一些想法,但我相信其他人也有同样的需求。什么对你真正有用?想法:在更新的系统上构建,静态链接到更新的glibc。(不可能吧?)在较新的系统上构建,针对较旧的glibc进行编译和链接。使用更新的gcc在旧系统上构建,链接旧glibc。在更新的系统上构建,动态链接到更新的glibc,设置RPath并为我们的glibc提供安装程序。另外,我的软件还支持插件并有一个SDK。我真的希望我的

c++ - 在 Clang 中使用具有函数本地类型的模板的类型计数器的意外结果

我编写了一个基于两种类型的类模板,根据其模板参数为其分配了唯一索引:templatestructComponent{staticuintconstindex;};期望对于每个新类型,index递增:Component::index;//0Component::index;//1Component::index;//0Component::index;//1//...etc分配索引的完整代码如下:usinguint=unsignedint;templatestructComponent{staticuintconstindex;};templateclassComponentCount{

c++ - 我如何使用 clang-format 缩进 C++ pragma?

我正在使用vim-autoformat,它使用clang-format作为外部格式化程序。clang-format似乎不会缩进C++#pragma。例如:#include#includeintmain(){#pragmaompparallelforfor(inti=0;i我想把它格式化成:#include#includeintmain(){#pragmaompparallelforfor(inti=0;i我检查了clangformat,但没有找到我可以使用的选项。 最佳答案 已经很晚了,但这是您正在寻找的解决方案。它将编译指示与代码

c++ - 为什么clang拒绝可变参数模板 friend 功能

我有以下示例代码,简化为基本代码,可使用gcc6.1、gcc7.0head和VisualStudio2015/2017RC编译,但不能使用任何clang版本。#include#includeusingnamespacestd;namespaceouter{namespacetest{templateautobar_(A&&,B&&,C&&...c){returnstd::make_tuple(c._p...);}}templateautobar(Aa,Bb,C&&...c){returntest::bar_(std::move(a),std::move(b),std::forward(

c++ - Clang 无法在 std::function 实例化中扩展参数包

使用std=c++17编译的代码片段作为唯一的编译器标志......使用GCC9.1成功编译。Godbolt...使用Clang8.0.0发出编译器错误(代码段下方的错误)。Godbolt问题:这是Clang编译器中的一个错误,还是GCC错误地接受此代码,还是其他原因?#include#includetemplatestructFoo{templateusingInt=int;//Functionthatacceptsasmany'int'astherearetemplateparametersusingFunction=std::function...)>;//Tupleofasma

c++ - g++ 和 clang++ 不同的行为与指向可变参数模板函数的指针

另一个“在g++和clang++之间谁是对的?”C++标准大师的问题。代码如下templatestructbar{};templatevoidfoo(barconst&){}intmain(){foo(bar{});//g++andclang++compile(*(&foo))(bar{});//g++andclang++giveerror(&foo)(bar{});//clang++compiles;g++giveserror}模板函数foo()接收可变参数模板参数bar.第一次通话foo(bar{});//g++andclang++compile适用于clang++和g++。如果我

c++ - 输出 endl 时出现 Clang 段错误

我正在尝试Clang(版本3.4,通过Windows预构建的二进制文件),看看它是否适合替代GCC(版本4.8.1,使用MinGW);但是,我无法让一个简单的程序运行。#includeintmain(){std::coutClang能够编译和链接程序,但运行它会产生SIGSEGV信号和返回码0xC0000005。输出字符串可以正常工作,但std::flush会导致相同的结果,尽管允许流自动刷新本身是可以的。调试程序只显示包含__mingw_CRTStartup()的调用堆栈(Clang使用libstdc++,因为它没有安装libc++)和std::cout().可能是什么原因造成的,如

c++ - `auto x = type{...}` 初始化语法和 `explicit` 转换运算符 - clang vs gcc

鉴于此代码(在wandbox上):structX{explicitoperatorint(){return0;}};intmain(){autoy=int{X{}};}以及以下编译器选项:-std=c++1z-Wall-Wextra-Wpedanticg++(测试版本:7、6.1、5.3)拒绝编译代码并出现以下错误error:cannotconvert'X'to'int'ininitializationclang++(测试版本:4、3.8、3.6)顺利编译代码段。哪个编译器在这里做正确的事情?cppreference似乎表明autovar=type{...}语法应该触发显式转换。

c++ - 如何在 clang 中选择特定的 gcc-toolchain?

Clang自动选择版本最高的gcc-version:$clang++-vmain.cppclangversion3.8.1-12(tags/RELEASE_381/final)Target:x86_64-pc-linux-gnuThreadmodel:posixInstalledDir:/usr/binFoundcandidateGCCinstallation:/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9FoundcandidateGCCinstallation:/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9.4Fo