CUDA编译错误
我在尝试在 CUDA SDK 中运行示例代码时收到此错误。我有 CUDA 2.3 和 Visual studio 2008
LINK:致命错误 LNK1181:无法打开输入文件“cutil32D.lib”
任何指针如何解决此问题?
I'm getting this error while trying to run sample codes in CUDA SDK. I have CUDA 2.3 and Visual studio 2008
LINK : fatal error LNK1181: cannot open input file 'cutil32D.lib'
Any pointers how to solve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我遇到了同样的问题。原来我不仅需要构建cutil项目,还需要构建SDK共享文件夹下的shrUtils项目。
I ran into the same issue. It turned out not only did I need to build the cutil project but also the shrUtils project under the SDK's shared folder.
由于您正在编译 SDK 示例,因此项目文件可能是正确的。更有可能的是您还没有构建 cutil 库。转到 SDK 安装目录,然后进入“C”目录。您将看到一个“common”目录,在其中打开 cutil.sln 解决方案(对于 VS2008,则为 cutil_vc90.sln),并在您的平台的发布和调试模式下构建它。
然后再次尝试您的样品。
cutil 库用于避免在所有示例中复制相同的代码,如果您要启动自己的项目,我会避免重用 cutil 库并编写自己的检查器。例如,如果检测到 CUDA 错误,您可能应该优雅地失败,而不是像 cutil 中那样只调用 exit() 。
强烈推荐 SDK 中包含的 cuda.rules 文件!使用此功能,您只需将 .cu 文件添加到任何项目,Visual Studio 将知道如何编译它们并将它们链接到最终的可执行文件。简单的!
Since you're compiling the SDK samples, the project files are probably correct. Far more likely is that you haven't built the cutil library. Go to the SDK install directory, then into the "C" directory. You'll see a "common" directory, in there open the cutil.sln solution (or cutil_vc90.sln for VS2008) and build it in release and debug modes for your platform.
Then try your sample again.
The cutil library is used to avoid replicating the same code through all the samples, if you're starting your own project I'd avoid reusing the cutil library and write your own checker. For example, you should probably fail gracefully if you detect a CUDA error rather than just calling exit() as done in cutil.
The cuda.rules file included in the SDK is highly recommended! Using this you can just add .cu files to any project and Visual Studio will know how to compile them and link them in to the final executable. Easy!
您的 MSVC 项目需要包含库
cutil32D.lib
才能链接。一旦将其指定为库,链接器需要将其包含在最终的二进制工件中,这个问题就会消失。链接器要查找的位置似乎缺少该库。您必须更改库搜索路径或将该文件移动到链接器已在其中查找的目录。Your MSVC project needs to include the library
cutil32D.lib
to link. Once you specify it as a library the linker needs to include in the final binary artifact this problem will go away. It would seem the library is missing at the location the linker is going to look for it. You'll have to change the library search paths or move that file to a directory in which the linker is already looking.