草庐IT

clang_complete

全部标签

c++ - G++ & Clang++ - 命名空间 std _GLIBCXX_VISIBILITY(默认)

我正在尝试使用clang++编译我的C++代码,但不断收到与namespace冲突的错误。我的main.cpp文件是一个简单的HelloWorld程序(用于调试)。我感觉问题出在我在集群上编译的GCC或clang版本上。关于如何追查这个问题的任何想法?或故障排除步骤?[aebrenne@hpcsrc]$gcc-vUsingbuilt-inspecs.COLLECT_GCC=gccCOLLECT_LTO_WRAPPER=/data/apps/gcc/4.8.1/libexec/gcc/x86_64-unknown-linux-gnu/4.8.1/lto-wrapperTarget:x86

c++ - 模板模板参数和 clang

我在使用模板模板参数和clang时遇到了问题(可能是我的问题)。以下玩具示例在g++4.7.0下编译和运行,而不是clang++3.0(基于LLVM3.0),两者都是ubuntu12.04。玩具示例(test_1.cpp):#include#includestructAFn{voidoperator()(){;//dosomething}};templatestructimpl{T*backpointer_;};templateclassT>structimplT{T*backpointer_;};templateclassAClass;templatestructimplT{impl

c++ - 为什么 clang 将字符串文字作为指针而不是数组?

#includeusingnamespacestd;voidf(constchar*arg){coutvoidf(constchar(&arg)[N]){cout我的编译器是clang3.8。输出是:argisapointer然而,根据cppreference.com,Thetypeofanunprefixedstringliteralisconstchar[].为什么重载决议的行为不如预期? 最佳答案 它确实按预期运行,你只需要调整你的期望;-)constchar[1]和constchar(&)[1]是不同的类型。到constch

c++ - "Clang with Microsoft CodeGen"和 "LLVM-vs2014"有什么区别?

在VisualStudio2015或更高版本下,我们可以通过两种方式使用clang:SelectClangwithMicrosoftCodeGenasthePlatformToolset;InstallLLVM-3.8-win64.exe,andselectLLVM-vs2014asthePlatformToolset;我知道这两种方式都使用相同的编译器:clang3.8。但是,我不知道它们之间有什么区别。我的经验表明ClangwithMicrosoftCodeGen比LLVM-vs2014更易于调试。换句话说:IcandebugaprogrambuiltbyClangwithMicr

c++ - clang vs gcc - 优化包括 operator new

我有一个我正在测试的简单示例,我注意到当涉及operatornew时,gcc优化(-O3)似乎不如clang优化。我想知道可能是什么问题,是否可以强制gcc以某种方式生成更优化的代码?templateT*create(){returnnewT();}intmain(){autoresult=0;for(autoi=0;i()!=nullptr);}returnresult;}#clang3.6++-O3-s--std=c++11test.cpp#sizea.outtextdatabssdechexfilename13246168194879ca.out#time./a.outreal0

c++ - clang try catch 失败

这是我所说的代码部分。try{std::cerr只是为了寻求细节,我正在使用boostprogram_options来解析配置文件。由于我在无法识别的文件中放置了一个选项,因此boost引发了一个异常。Clang没有捕捉到这个异常是有问题的。基本上我只在输出中看到firsttrylibc++abi.dylib:terminatingwithuncaughtexceptionoftypeboost::exception_detail::clone_impl>:unrecognisedoption'TestFrequency'Aborttrap:6这是我的clang版本:c++--vers

c++ - clang 中的别名 std::initializer_list

我想使用std::initializer_list的别名来代替它本身:#includetemplateusingInitializerList=std::initializer_list;//note:candidatetemplateignored:couldn'tinfertemplateargument'T'templatevoidf(InitializerListlist){}intmain(){//error:nomatchingfunctionforcallto'f'f({1,2,3,4,5});}该代码使用gcc&cl没问题。但是,使用clang我得到一个错误::11:3

c++ - clang thread_local 初始化中的错误

下面的代码应该只创建一次类内thread_local,但它最终会在每次访问时初始化它#include#includeusingstd::cout;usingstd::endl;templateclassSomething{public:structTLBookkeeping{TLBookkeeping(){std::coutthread_localtypenameSomething::TLBookkeepingSomething::bookkeeping_;templatevoidSomething::foo(){std::cout::foo();}(https://wandbox.o

c++ - 如何在 Mac OSX clang 上获得对 thread_local 的支持?

如图thisanswer,即使设置了C++11标志,MacOSX上Xcode的clang也不支持thread_local存储。即使在最新版本上,AppleLLVM版本7.0.0(clang-700.1.76),目标:x86_64-apple-darwin15.0.0,线程模型:posix,不支持thread_local:../../src/dir/sysArch.h:1505:3:error:thread-localstorageisnotsupportedforthecurrenttargetthread_local^ 最佳答案

C++17 std::variant 头文件 (clang 6.0.0)

更新我将问题缩小到(可能!这还不完全清楚,甚至阅读了我能找到的关于该主题的所有内容)安装stdlibc++-7-dev会为我提供合适的(即C++17兼容)STLheader和库。这(同样,显然)与Ubuntu17.04(artful?)捆绑在一起,但不适用于xenial(Ubuntu16.04.3LTS),这就是我的我正在使用。我已经尝试下载单独的.deb包并安装它们,但它很快就会变成一个Unresolved依赖项的迷宫。如果有人能告诉我如何在16.04上安装libstdc++-7-dev,我将不胜感激。原始问题我刚刚通过包管理器(在theseinstructions之后)在Ubunt