简体   繁体   English

Visual Studio 在其他包含文件夹中找不到头文件

[英]Visual studio cannot find the header files in Additional Include folders

I have been seeing this occasionally, but this project in particular is causing me to tear my hair out.我偶尔会看到这个,但这个项目尤其让我把头发扯掉。

I have my .cpp .我有我的.cpp

#include <nppi.h>
#include <cuda.h>
#include <device_functions.h>
#include <cuda_runtime.h>

The Headers are in My project directory, in:标题位于我的项目目录中:

<Project file>\Thirdparty\CUDA\v8.0\include

my Additional includes are:我的附加包括:

$(ProjectDir)Thirdparty\CUDA\v8.0\include

i have also tried:我也试过:

Thirdparty\CUDA\v8.0\include

The includes are not found by intellisense, and i cannot open them with a right click. intellisense 找不到包含,我无法通过右键单击打开它们。 What am i doing wrong?我究竟做错了什么? or is this a bug?或者这是一个错误?

Even with a hardcoded path in the Additional includes, the files are not found.即使在附加包含中使用硬编码路径,也找不到文件。

I am in Release mode.我处于发布模式。 If i switch to Debug mode, some of the files are found, but some are not.如果我切换到调试模式,会找到一些文件,但有些文件没有。 The Additional includes seem to stay the same when I switch, this seems odd.当我切换时,附加包含似乎保持不变,这看起来很奇怪。 (I have not added additional includes for Debug). (我没有为调试添加额外的包含)。

Thank you for your help, this is driving me mad.谢谢你的帮助,这让我很生气。

Create a new folder named "include" in your project directory.在您的项目目录中创建一个名为“include”的新文件夹。 Right-click on the project and then on Properties.右键单击项目,然后单击“属性”。 CUDA C/C++ -> Additional Include Directories. CUDA C/C++ -> 附加包含目录。 Type into the upper half $(ProjectDir)include.在上半部分输入 $(ProjectDir)include。 it should evaluate this path correctly.它应该正确评估这条路径。 Check that!检查那个! In your kernel.cu that includes your main-function, type in #include "include\\mycode.cu".在包含主函数的 kernel.cu 中,输入 #include "include\\mycode.cu"。 That worked for me.那对我有用。 Good luck!祝你好运!

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

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