nurabha
nurabha

Reputation: 1212

CUDA 6.5: error MSB3191 Unable to create directory and LNK2001 Unresolved External symbol

I am running CUDA 6.5 on Visual Studio 2013 x64.

I have a VC++ static library project named MyLib which is linked with MyClient x64 console executable project. I added CUDA 6.5 build customization to both the projects. In addition, I goto Configuration Properties -> CUDA C/C++ and have set “Target Machine Platform” as 64-bit for these two projects as I want to compile them for x64 platform

I added MyCUDACode.cpp and MyCUDACode.h files to MyLib project and marked their item type as CUDA C/C++ instead oc C/C++ compiler. MyCUDACode.cpp has number of functions which call CUDA API functions. Also, MyCUDACode.h references the cuda.h and cuda_runtime.h files.

MyClient is linked with MyLib. I now get two compilation errors:

I have tried both release and debug modes but I get same error.

Upvotes: 0

Views: 3176

Answers (1)

nurabha
nurabha

Reputation: 1212

I am just reproducing the steps to resolve the errors:

  • To resolve the error(temporary workaround): MSB3191: Unable to create directory The given path's format is not supported., simply copy Cuda cu and cuh files to Visual studio project folder.
  • [UPDATE]: I recently found a better solution for the issue MSB3191: Unable to create directory The given path's format is not supported.. This fix works without need to move around the cu files to the VS project folder. For this, open the file "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\BuildCustomizations\CUDA 6.5.targets", and move to the offending line(412 in this case). This line contains following xml section:

    <MakeDir
        Condition="'%(CudaCompile.ExcludedFromBuild)' != 'true'"
        Directories="%(CudaCompile.DepsOutputDir)" />
    

    As you can see, this is a sort of directive which tells the build system to make a folder for the cuda files being compiled. The property used for folder name is CudaCompile.DepsOutputDir. Now open the file: "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\BuildCustomizations\CUDA 6.5.props". This props file defines values of the properties used in targets file. Now search for word DepsOutputDirin this props file. There are only XML section which defines and refers to this keyword is:

        <!-- Miscellaneous -->
        <DepsOutputFile>%(Filename)%(Extension).deps</DepsOutputFile>
        <DepsOutputDir>$(IntDir)%(RelativeDir)</DepsOutputDir>
        <DepsOutputPath>%(DepsOutputDir)%(DepsOutputFile)</DepsOutputPath> 
    

    Now, to finally fix the MSB3191 issue, simply remove the variable %(RelativeDir) from above xml section and save the props file (this would require administrative privileges)

  • To resolve the error: LNK2001: unresolved external symbol, follow the Settings for Linker section in this post

Upvotes: 4

Related Questions