简体   繁体   English

CUDA-OpenCV-Visual Studio 2010中的C ++链接错误

[英]CUDA - OpenCV - C++ Linking Error in Visual Studio 2010

I am using Visual Studio 2010 environment and am trying to accelerate some of my previously written OpenCV algorithms with the help of CUDA. 我正在使用Visual Studio 2010环境,并尝试在CUDA的帮助下加速一些以前编写的OpenCV算法。 I have a separate .cu file that compiles fine individually in Visual Studio and my .cpp file also compiles fine individually. 我有一个单独的.cu文件,可以在Visual Studio中单独编译,而我的.cpp文件也可以单独进行编译。

But when I try to build the solution that contains both of these files I get an error as below: 但是,当我尝试构建包含这两个文件的解决方案时,出现如下错误:

error LNK2019: unresolved external symbol "void __cdecl ComputeBasisKernelWrapper(float *,float *,float *,float *,float *,float *,float *,float *,float *,int,int)" 错误LNK2019:无法解析的外部符号“ void __cdecl ComputeBasisKernelWrapper(float *,float *,float *,float *,float *,float *,float *,float *,float *,int,int)”

ComputeBasisKernelWrapper is a function that is defined using extern "C" in the .cu file and is responsible for making the necessary CUDA allocations and carrying out parallel computations. ComputeBasisKernelWrapper是使用.cu文件中的extern“ C”定义的函数,它负责进行必要的CUDA分配并执行并行计算。

I have a similar framework that works fine where I use a non object-oriented .c file that makes calls to functions in a .cu file. 我有一个类似的框架,在使用非面向对象的.c文件(可在.cu文件中调用函数)的情况下,它可以很好地工作。

So, I am not sure whether I need to make some changes in the compilation settings or if something else is the issue. 因此,我不确定是否需要对编译设置进行一些更改,或者是否存在其他问题。

Any help is appreciated. 任何帮助表示赞赏。

通过删除“外部”解决了此问题。

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

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