首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >GCC 4.3.4与CLANG 3.5兼容

GCC 4.3.4与CLANG 3.5兼容
EN

Stack Overflow用户
提问于 2014-02-27 08:48:45
回答 1查看 282关注 0票数 1

我正在建设一个基于C++11的项目,所以它至少需要GCC 4.7.2,它没有安装在我的平台上(而且我没有在上面升级软件的许可)。因此,另一种选择是使用Clang和我下载并构建CLang 3.5构建该项目。在平台上预装了GCC 4.3.4。

当我编译代码时,我得到了很多类似的错误:

代码语言:javascript
复制
[ 88%] Building CXX object system/CMakeFiles/Grappa.dir/tasks/TaskingScheduler.cpp.o
cd /home/frolo/grappa/build/Make+Release/system && /home/frolo/llvm/build/Debug+Asserts/bin/clang++   -DENABLE_RDMA_AGGREGATOR -DGASNET_CONDUIT_IBV -DGASNET_IBV -DGASNET_SEQ -DSHMMAX=1844674407
3709551615 -std=c++11 -Winline -Wno-inline -mno-red-zone -O3 -g -I/home/frolo/grappa/build/Make+Release/third-party/include -I/home/frolo/grappa/build/Make+Release/third-party/include/ibv-condu
it -I/usr/mpi/gcc/openmpi-1.6.4/include -I/home/frolo/grappa/system -I/home/frolo/grappa/system/tasks    -o CMakeFiles/Grappa.dir/tasks/TaskingScheduler.cpp.o -c /home/frolo/grappa/system/tasks
/TaskingScheduler.cpp
In file included from /home/frolo/grappa/system/Barrier.cpp:24:
In file included from /home/frolo/grappa/system/Barrier.hpp:26:
In file included from /home/frolo/grappa/system/ConditionVariable.hpp:27:
In file included from /home/frolo/grappa/system/Message.hpp:27:
In file included from /home/frolo/grappa/system/MessageBase.hpp:33:
In file included from /home/frolo/grappa/system/ConditionVariableLocal.hpp:27:
/home/frolo/grappa/system/tasks/TaskingScheduler.hpp:178:25: error: no matching constructor for initialization of 'std::ofstream' (aka 'basic_ofstream<char>')
          std::ofstream f(FLAGS_stats_blob_filename);
                        ^ ~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../include/c++/4.3/fstream:571:7: note: candidate constructor not viable: no known conversion from '::fLS::clstring' (aka 'basic_string<char>') to 
'const char *' for 1st argument
      basic_ofstream(const char* __s,
      ^
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../include/c++/4.3/bits/fstream.tcc:916:25: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from '::fLS
::clstring' (aka 'basic_string<char>') to 'const std::basic_ofstream<char>' for 1st argument
  extern template class basic_ofstream<char>;
                        ^
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../include/c++/4.3/fstream:556:7: note: candidate constructor not viable: requires 0 arguments, but 1 was provided
      basic_ofstream(): __ostream_type(), _M_filebuf()
      ^
In file included from /home/frolo/grappa/system/IncoherentAcquirer.cpp:24:
In file included from /home/frolo/grappa/system/IncoherentAcquirer.hpp:28:
In file included from /home/frolo/grappa/system/Message.hpp:27:
In file included from /home/frolo/grappa/system/MessageBase.hpp:33:
In file included from /home/frolo/grappa/system/ConditionVariableLocal.hpp:27:
/home/frolo/grappa/system/tasks/TaskingScheduler.hpp:178:25: error: no matching constructor for initialization of 'std::ofstream' (aka 'basic_ofstream<char>')
          std::ofstream f(FLAGS_stats_blob_filename);
                        ^ ~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../include/c++/4.3/fstream:571:7: note: candidate constructor not viable: no known conversion from '::fLS::clstring' (aka 'basic_string<char>') to 
'const char *' for 1st argument
      basic_ofstream(const char* __s,
      ^
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../include/c++/4.3/bits/fstream.tcc:916:25: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from '::fLS
::clstring' (aka 'basic_string<char>') to 'const std::basic_ofstream<char>' for 1st argument
  extern template class basic_ofstream<char>;

..。

看来gcc 4.3.4和clang 3.5之间不兼容,不是吗?我不是一个有经验的clang使用者,在这里能做些什么来修复它?

谢谢你的帮助!

最好,亚历克斯

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-02-27 10:08:14

Clang3.5使用gcc 4.7 ABI,所以您应该使用gcc >= 4.7进行编译。或者,您可以每晚从.deb下载基于Ubuntu/Debian的Linux发行版的LLVM/Clang版本。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22063328

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档