简体   繁体   English

编译错误nvcc和BOOST库

[英]compiling error nvcc and BOOST library

nvcc throws nvcc抛出

/usr/include/boost/concept/detail/has_constraints.hpp:29: error: ‘&’ cannot appear in a constant-expression
/usr/include/boost/concept/detail/has_constraints.hpp:29: error: template argument 2 is invalid

the has_constraints.hpp already has some suspicious code in it: has_constraints.hpp中已经有一些可疑代码:

#if BOOST_WORKAROUND(__SUNPRO_CC, <= 0x580)
  // Work around the following bogus error in Sun Studio 11, by
  // turning off the has_constraints function entirely:
  //    Error: complex expression not allowed in dependent template
  //    argument expression
  inline no has_constraints_(...);
#else
  template <class Model>
  inline yes has_constraints_(Model*, wrap_constraints<Model,&Model::constraints>* = 0);
  inline no has_constraints_(...);
#endif

Question: is this a nvcc boost incompatibility or could there be something wrong with my code? 问题:这是一个nvcc提升不兼容还是我的代码可能有问题?

Why do you have the "&" before "Model::constraints"? 为什么在“Model :: constraints”之前有“&”? I would think that's the problem. 我认为这就是问题所在。 (// it's not apparently) (//显然不是)

EDIT: 编辑:

http://forums.nvidia.com/index.php?showtopic=182890 talk about this issue and have some hack work arounds http://forums.nvidia.com/index.php?showtopic=182890谈论这个问题并进行一些黑客工作

http://forums.nvidia.com/index.php?showtopic=150025 http://forums.nvidia.com/index.php?showtopic=150025

EDIT2: EDIT2:

Well, after running around this for a while, this is what I'm sticking with: 好吧,经过一段时间的运行,这就是我坚持的:

http://forums.nvidia.com/index.php?showtopic=215470 "There is a known compatibility issue with boost and nvcc. A work around is to split the sources such that you compile the cuda code with nvcc and the boost code with the host compiler." http://forums.nvidia.com/index.php?showtopic=215470 “与boost和nvcc存在已知的兼容性问题。解决方法是拆分源代码,以便使用nvcc和boost代码编译cuda代码与主机编译器。“ by Justin Luitjens in the Group: NVIDIA Employees 作者:Justin Luitjens在集团:NVIDIA员工

Try it out, but if you can't make it work, compile separately, and then link them. 尝试一下,但如果你不能使它工作,单独编译,然后链接它们。

I have a patch here http://code.google.com/p/asadchev/source/browse/trunk/projects/boost/boost-1.46.0.nvcc.patch 我在这里有一个补丁http://code.google.com/p/asadchev/source/browse/trunk/projects/boost/boost-1.46.0.nvcc.patch

Perhaps you can see what is changed and fix your code likewise 也许您可以看到更改的内容并同样修复您的代码

Be aware that the source is seen by both, gcc-like and egg-like compiler parts. 请注意,gcc-like和egg-like编译器部分都可以看到源代码。

我们最后做的是将has_constraints_关闭,就像在Sun Studio 11的问题中引用的示例一样

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM