CUDACOMPILE : Command-line error : too many arguments on command line

Hi,
I am trying to compile a .cu file but I keep getting the “too many arguments on command line” error. I am sorry for not being able to share code here but my command line looks like this and it also inherits some properties from the parent VS solution:

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\extras\visual_studio_integration\MSBuildExtensions\CUDA 8.0.targets(687,9): error MSB3721: The command ““C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin\nvcc.exe” -gencode=arch=compute_50,code=“sm_50,compute_50” --use-local-env --cl-version 2013 -ccbin “I:\tfs\ASEng\Tools\vc\bin\x32\x86” -I”…Interfaces.debug.x86.130.1700.1172.2874017\build\native\include" -I"…debug.amd64\native\include" -I"I:…lib.debug.x86.140.600.120.3032557\build\native\include" -II:\tfs\ASEng.obj.x86Debug…vcxproj -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include" -II:…\prebuild\prebuild.vcxproj -II:…\fsf.vcxproj -II:\custom\include -II:\Tools\vc\include -II:\Tools\vc\atlmfc\include -I"I:…\um" -I"I:\6.3.9600.5\include\shared" -II:\tfs…\version\ -II:\tfs…\x86\inc -II:…\inc -II:…\include -II:\tfs\ext\vp -II:\xe -II:\se\include -II:\xe\include -II:\shared -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include" -G --keep-dir I:\xmcuda.vcxproj -maxrregcount=0 --machine 32 --compile -cudart static -Xcudafe “–diag_suppress=expr_has_no_effect,signed_one_bit_field” -g -D_DEBUG -DWIN32 -D_DEBUG -DSTANDALONE_SQLSORT -D_MSPICASSOCOMPONENTBUILD_ -D_MSPICASSONOSKUBUILD_ -D_CRT_SECURE_NO_DEPRECATE -D_SQL_IGNORE_4703 -D_SAL2_STRICT -D_UNICODE -DUNICODE -D_DEBUG -DDEBUG -DMSC_NOOPT -Xcompiler “/EHsc /W4 /nologo /Od /FS /Zi /RTC1 /MDd /GR-” -o I:\xmcuda.vcxproj\Launcher_All.cu.obj “I:\query\xLauncher_All.cu”" exited with code 4. [I:\xmcuda.vcxproj]

Wondering if too many arguments really means too much characters. I see a lot of subpaths and long pathnames. See if you can clean those up and use short paths.

Here is perhaps an idea:
https://stackoverflow.com/questions/3861474/command-copy-exited-with-code-4-when-building-visual-studio-restart-solves-it

Another:
https://stackoverflow.com/questions/5626557/what-is-going-wrong-when-visual-studio-tells-me-xcopy-exited-with-code-4

Also, you can supply a verbose commnand to nvcc as:

--verbose                                  (-v)                              
        List the compilation commands generated by this compiler driver, but do not
        suppress their execution.

That should point out what is the issue.

The verbose option did not help very much but I finally found out what is causing the problem:

-Xcudafe “–diag_suppress=expr_has_no_effect,signed_one_bit_field”

When I removed one of the warning codes in the above line the error goes away. But I need to suppress both the warnings. How do I do this?

I wonder: Is that correct syntax? Is -Xcudafe a valid switch? Is the syntax of --diag-suppress valid? The fact that the command-line parser diagnoses “too many arguments” suggests that what you intend to be one argument is in reality treated as two. What happens if you split this, i.e.

-Xcudafe --diag_suppress=expr_has_no_effect -Xcudafe --diag_suppress=signed_one_bit_field

Maybe also try with and without the double quotes.

Splitting them did fix the problem (BTW quotes does not seem to matter)…