Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
GCC 4.3.4和CLANG 3.5兼容性_Gcc_C++11_Clang - Fatal编程技术网

GCC 4.3.4和CLANG 3.5兼容性

GCC 4.3.4和CLANG 3.5兼容性,gcc,c++11,clang,Gcc,C++11,Clang,我正在构建一个基于C++11的项目,所以它至少需要GCC4.7.2,而我的平台上并没有安装它(而且我没有在上面升级软件的权限)。所以另一个选择是使用Clang构建项目,我下载并构建了Clang 3.5。平台上预装了GCC 4.3.4 在编译代码时,我遇到了很多类似的错误: [ 88%] Building CXX object system/CMakeFiles/Grappa.dir/tasks/TaskingScheduler.cpp.o cd /home/frolo/grappa/build/

我正在构建一个基于C++11的项目,所以它至少需要GCC4.7.2,而我的平台上并没有安装它(而且我没有在上面升级软件的权限)。所以另一个选择是使用Clang构建项目,我下载并构建了Clang 3.5。平台上预装了GCC 4.3.4

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

[ 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>;
[88%]构建CXX对象系统/cmakfiles/Grappa.dir/tasks/TaskingScheduler.cpp.o
cd/home/frolo/grappa/build/Make+Release/system&/home/frolo/llvm/build/Debug+Asserts/bin/clang++-DENABLE_RDMA_聚合器-DGASNET_conductor_IBV-DGASNET_IBV-DGASNET_-DGASNET_SEQ-DSHMMAX=1844674407
3709551615-std=c++11-Winline-Wno-inline-mno红色区域-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
在文件中包括/home/frolo/grappa/system/Barrier.cpp:24:
文件中包括/home/frolo/grappa/system/Barrier.hpp:26:
包含在/home/frolo/grappa/system/ConditionVariable.hpp:27中的文件中:
包含在/home/frolo/grappa/system/Message.hpp:27中的文件中:
在/home/frolo/grappa/system/MessageBase.hpp:33中包含的文件中:
在/home/frolo/grappa/system/ConditionVariableLocal.hpp:27中包含的文件中:
/home/frolo/grappa/system/tasks/TaskingScheduler.hpp:178:25:错误:没有用于初始化“std::of stream”(也称为“basic_of stream”)的匹配构造函数
流f的std::of(FLAGS\u stats\u blob\u filename);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../../../../../include/c++/4.3/fstream:571:7:注意:候选构造函数不可行:没有已知的从“::fLS::clstring”(也称为“基本字符串”)到
第一个参数为“const char*”
基本流(常量字符*),
^
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../../../../../include/c++/4.3/bits/fstream.tcc:916:25:注意:候选构造函数(隐式副本构造函数)不可行:没有从“::fLS进行已知转换
::clstring'(也称为“基本字符串”)到第一个参数的“const std::basic_of stream”
流的外部模板类basic_;
^
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../../../../../include/c++/4.3/fstream:556:7:注意:候选构造函数不可行:需要0个参数,但提供了1个参数
流()的基本类型:u ostream_type(),_M_filebuf()
^
文件中包括/home/frolo/grappa/system/incocherentacquirer.cpp:24:
文件中包括/home/frolo/grappa/system/incocherentacquirer.hpp:28:
包含在/home/frolo/grappa/system/Message.hpp:27中的文件中:
在/home/frolo/grappa/system/MessageBase.hpp:33中包含的文件中:
在/home/frolo/grappa/system/ConditionVariableLocal.hpp:27中包含的文件中:
/home/frolo/grappa/system/tasks/TaskingScheduler.hpp:178:25:错误:没有用于初始化“std::of stream”(也称为“basic_of stream”)的匹配构造函数
流f的std::of(FLAGS\u stats\u blob\u filename);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../../../../../include/c++/4.3/fstream:571:7:注意:候选构造函数不可行:没有已知的从“::fLS::clstring”(也称为“基本字符串”)到
第一个参数为“const char*”
基本流(常量字符*),
^
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../../../../../include/c++/4.3/bits/fstream.tcc:916:25:注意:候选构造函数(隐式副本构造函数)不可行:没有从“::fLS进行已知转换
::clstring'(也称为“基本字符串”)到第一个参数的“const std::basic_of stream”
流的外部模板类basic_;

看起来gcc 4.3.4和clang 3.5之间不兼容,不是吗?我不是clang的经验丰富的用户,这里可以做些什么来修复它

谢谢你的帮助

最好的,
Alex

Clang 3.5使用了,所以你应该使用gcc>=4.7进行编译。或者,你可以从中下载基于Ubuntu/Debian的Linux发行版的.deb格式的夜间LLVM/Clang版本。

如果你可以下载并安装Clang,为什么你不能下载并安装gcc?嗯。我认为使用Clang会更容易。将Clang与G结合使用CC 4.3.4的libstdc++对我来说似乎是一个非常糟糕的主意。如果您确实使用clang,请将其与libc++或更新版本的GCC的libstdc++一起使用。