Linker errors 2005 and 1169 (multiply defined symbols) when using CUDA __device__ functions (should be inline by default)

青春壹個敷衍的年華 提交于 2019-12-06 10:05:31

In MS VS, as well as in gcc and possibly other compilers (but not in the one referenced by your "multiply defined linker error" link), inline implies static by default. You can force a function to be extern inline, but, unless you do, the compiler either won't place an external definition of the function into the object file, or will mark it as safe to duplicate somehow.

HOWEVER, nowhere in the documentation does it say that CUDA __device__ functions are effectively declared inline (and therefore static). The documentation says that the function is "always inlined by default". There's a subtle difference.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!