-1

I have a project in Visual Studio 2013 with the CUDA Toolkit 7.5 where inclusion of header files works for .cpp files but not for .cu files. I have a header file test.h and its implementation test.cu as well as the main.cu file.

The file structure is:

projectdir/
    /include
        /test.h
    /src
        /test.cu
        /main.cu

In the project properties page, I have the following set up:

Configuration Properties -> C/C++ -> Additional Include Directories =
$(ProjectDir)include;%(AdditionalIncludeDirectories)

Configuration Properties -> CUDA C/C++ -> Common -> Additional Include Directories =
$(ProjectDir)include;%(Include)

#include "../include/test.h" compiles, #include "test.h" does not compile in the .cu files.

Here is a pastebin of the error output.

Here is a pastebin of the CUDA C/C++ Command Line settings as well as the source code.

Any help to resolve this is greatly appreciated. While the #include ../include/test.h lets me run the program it's annoying to not have it work properly.

15
  • Can you see what arguments your .c and .cpp endsup with? Apr 24, 2016 at 11:45
  • Can you specify more in detail what you are looking for? Kind of a novice here. Apr 24, 2016 at 11:54
  • 1
    In your text, you say the implementation of test.h is in test.cu, but in your section described as "file structure" you list a test.cpp not test.cu. What filenames and structures do you actually have? Apr 24, 2016 at 14:46
  • 1
    And what does "works" and "not work" mean? What error messages is the compiler emitting?
    – talonmies
    Apr 24, 2016 at 14:46
  • 1
    How is it then that the main.cu in your pastebin output compiles without error? Apr 25, 2016 at 17:43

1 Answer 1

0

Solved by adding the include path to VC++ options as well. Apparently this is needed for .cu-files but not for .cpp-files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.