Release Compiles Debug will not

I am using Intel 19.1(2020.0.2.899) C++ compiler with Visual Studio 2019 v16.7.5. When I add build
dependency to use Cuda v11.3, I got the compiler linking error LNK2019 in Debug mode without adding CUDA code. Attached with my compiler and linker settings.

3>------ Build started: Project: VMC, Configuration: Debug x64 ------
3>LINK : : warning LNK4075: ignoring ‘/INCREMENTAL’ due to ‘/PROFILE’ specification
3> Creating library x64\Debug\ProductionModule3D.lib and object x64\Debug\ProductionModule3D.exp
3>cudadevrt.lib(cuda_device_runtime.obj) : : error LNK2019: unresolved external symbol __cudaRegisterLinkedBinary_38_cuda_device_runtime_compute_86_cpp1_ii_8b1a5d37 referenced in function “void __cdecl __sti____cudaRegisterAll(void)” (?__sti____cudaRegisterAll@@YAXXZ)
3>x64\Debug\ProductionModule3D.exe : : error LNK1120: 1 unresolved externals
Capture

/OUT:“x64\Debug\ProductionModule3D.exe” /MANIFEST /PROFILE /PDB:“x64\Debug\ProductionModule3D.pdb” /DYNAMICBASE:NO “psapi.lib” “kernel32.lib” “vfw32.lib” “opengl32.lib” “glu32.lib” “TKVrml.lib” “TKStl.lib” “TKBrep.lib”
“TKIGES.lib” “TKShHealing.lib” “TKStep.lib” “TKXSBase.lib” “TKShapeSchema.lib” “FWOSPlugin.lib” “PTKernel.lib” “TKBool.lib” “TKCAF.lib” “TKCDF.lib” “TKernel.lib” “TKFeat.lib” “TKFillet.lib” “TKG2d.lib” “TKG3d.lib”
“TKGeomAlgo.lib” “TKGeomBase.lib” “TKHLR.lib” “TKMath.lib” “TKMesh.lib” “TKOffset.lib” “TKPCAF.lib” “TKPrim.lib” “TKPShape.lib” “TKService.lib” “TKTopAlgo.lib” “TKV2d.lib” “TKV3d.lib” “TKBO.lib” “ZipArchive.lib”
“TKSTEPBase.lib” “TKSTEP209.lib” “TKSTEPAttr.lib” “PM3DSchemaLib.lib” “twsce.lib” “mkl_intel_lp64.lib” “mkl_core.lib” “mkl_sequential.lib” “cudart.lib” “cudadevrt.lib” “C:\Projects\PM3D\PD_PM3D\x64\Debug\PM3DSchemaLib.lib”
/DEBUG /MACHINE:X64 /SAFESEH:NO /INCREMENTAL /SUBSYSTEM:WINDOWS /MANIFESTUAC:“level=‘asInvoker’ uiAccess=‘false’” /ManifestFile:“x64\Debug\ProductionModule3D.exe.intermediate.manifest”
/NOLOGO /LIBPATH:“C:\OpenCASCADE6.5.3\ros\win64\vc19\lib” /LIBPATH:“C:\boost\1_73_0\stage\lib” /LIBPATH:“C:\Projects\PM3D\PD_PM3D\x64\Debug”
/LIBPATH:“C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2020.2.254\windows\mkl\lib\intel64” /LIBPATH:".\twsce\lib\x64\debug"
/LIBPATH:“C:\Program Files\Liquid Technologies\Liquid Studio 2020\XmlDataBinder18\Redist18\cpp\win64\lib” /LIBPATH:".\ZipArchive\x64\Debug STL MD"
/LIBPATH:“C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\lib\x64” /TLBID:1

/Yu"stdafx.h" /MP /GS /Qopenmp /W3 /Qdiag-disable:“4996” /Qdiag-disable:“4800” /Qdiag-disable:“4101” /Qdiag-disable:“4138” /Qdiag-disable:“1786” /Zc:wchar_t /I"glm" /I"nglib\libsrc\include"
/I"MeshGen\src" /I"VRONI_3.2\src" /I"." /I"C:\OpenCASCADE6.5.3\ros\inc" /I"DistortionC++" /I".\ZipArchive\Libraries" /I"ThirdWAVI" /I"C:\OpenCASCADE6.5.3\ros\drv\STEPData" /I"c:\boost\1_73_0"
/I"C:\Projects\PM3D\PD_PM3D\API" /I".\xml" /I".\xml\converters" /I".\xml\parsers" /I".\datasets" /I".\datasets\configurations" /I".\datasets\tools" /I".\datasets\workpieces" /I"Errors" /I"Messages"
/I"PMCommonLibrary\Include" /I"C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2020\windows\mkl\include" /I".\twsce\include" /I"C:\Dev\LiquidXML" /I"PMCommonLibrary\navigator"
/I".\UserInterface\Dockablebar" /I".\UserInterface" /I".\UserInterface\SequenceTreeView" /I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\include" /Zi /Od /Fd"x64\Debug"
/Zc:inline /fp:precise /D “TPI” /D “WIN64” /D “_DEBUG” /D “_WINDOWS” /D “RAND” /D “MIC” /D “NO_CPUTIME” /D “WMAT” /D “RANDOM” /D “NDEBUG” /D “ARC_APX” /D “WNT” /D “CSFDB” /D “OCCGEOMETRY”
/D “NO_PARALLEL_THREADS” /D “PM3D_DISTORTION_INTEGRATION” /D “_RTLDLL” /D “SORT_OPT_PREFETCHING” /D “USE_MALLOC_LOCK” /D “COUNT_WAIT_TIME” /D “_FILE_OFFSET_BITS=64” /D “_LARGEFILE_SOURCE”
/D “_LARGEFILE64_SOURCE” /D “_SCL_SECURE_NO_DEPRECATE” /D “PM3D_LICENSE” /D “PM3D” /D “AEDM_ACTIVE” /D “BATCH_LIBRARY” /D “MESSAGEDLL_EXPORTS” /D “TRANSPORTDLL_EXPORTS” /D “PIPEWRAPDLL_EXPORTS”
/D “MKL_LP64” /D “_VC80_UPGRADE=0x0710” /D “_MBCS” /D “_AFXDLL” /Zc:forScope /MDd /FC /Fa"x64\Debug" /EHsc /nologo /Fo"x64\Debug" /Qprof-dir “x64\Debug” /Fp"x64\Debug\VMC.pch"

Please don’t attach text files. The forum provides methods to format text (and/or code) in-line with your question.

i have made that edit

linking against cudadevrt would ordinarily require relocatable device compilation (-dc or -rdc=true) with a device linking step. I’m not sure your project actually requires that, but it might, and I don’t see those settings in your compile/link settings.

If that were a project config difference between release and debug projects, that could explain it.

thanks for the quick reply.

I have changed my debug compiler settings like release mode and use -rdc=true but there is no help to remove the link error.

Cuda compiler settings:

(Approximate command-line. Settings inherited from host are not visible below.)

(Please see the output window after a build for the full command-line)

Driver API (NVCC Compilation Type is .cubin, .gpu, or .ptx)

set CUDAFE_FLAGS=–sdk_dir “C:\Program Files (x86)\Windows Kits\10”
“C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\bin\nvcc.exe” --use-local-env -ccbin “C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.27.29110\bin\HostX64\x64” -x cu -rdc=true -G --keep-dir x64\Debug -maxrregcount=0 --machine 64 --compile -cudart static -o x64\Debug%(Filename)%(Extension).obj “%(FullPath)”

Runtime API (NVCC Compilation Type is hybrid object or .c file)

set CUDAFE_FLAGS=–sdk_dir “C:\Program Files (x86)\Windows Kits\10”
“C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\bin\nvcc.exe” --use-local-env -ccbin “C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.27.29110\bin\HostX64\x64” -x cu -rdc=true -G --keep-dir x64\Debug -maxrregcount=0 --machine 64 --compile -cudart static -Xcompiler "/EHsc /nologo /FS " -o x64\Debug%(Filename)%(Extension).obj “%(FullPath)”

CUDA linker settings:

(Approximate command-line. Settings inherited from host are not visible below.)

(Please see the output window after a build for the full command-line)

“C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\bin\nvcc.exe” -dlink -o x64\Debug\ProductionModule3D.device-link.obj -Xcompiler “/EHsc /nologo /Zi " -L"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\bin/crt”

You’re missing either cudart or cudadevrt from your link settings.

I have both of my C++ and CUDA linker but the link error is still there.

C++ Linker:
/OUT:“x64\Debug\ProductionModule3D.exe” /MANIFEST /PROFILE /PDB:“x64\Debug\ProductionModule3D.pdb” /DYNAMICBASE:NO “psapi.lib” “kernel32.lib” “vfw32.lib” “opengl32.lib” “glu32.lib” “TKVrml.lib” “TKStl.lib” “TKBrep.lib” “TKIGES.lib” “TKShHealing.lib” “TKStep.lib” “TKXSBase.lib” “TKShapeSchema.lib” “FWOSPlugin.lib” “PTKernel.lib” “TKBool.lib” “TKCAF.lib” “TKCDF.lib” “TKernel.lib” “TKFeat.lib” “TKFillet.lib” “TKG2d.lib” “TKG3d.lib” “TKGeomAlgo.lib” “TKGeomBase.lib” “TKHLR.lib” “TKMath.lib” “TKMesh.lib” “TKOffset.lib” “TKPCAF.lib” “TKPrim.lib” “TKPShape.lib” “TKService.lib” “TKTopAlgo.lib” “TKV2d.lib” “TKV3d.lib” “TKBO.lib” “ZipArchive.lib” “TKSTEPBase.lib” “TKSTEP209.lib” “TKSTEPAttr.lib” “PM3DSchemaLib.lib” “twsce.lib” “mkl_intel_lp64.lib” “mkl_core.lib” “mkl_sequential.lib” “cudart.lib” “cudadevrt.lib” “C:\Projects\PM3D\PD_PM3D\x64\Debug\PM3DSchemaLib.lib” /DEBUG /MACHINE:X64 /SAFESEH:NO /INCREMENTAL /SUBSYSTEM:WINDOWS /MANIFESTUAC:“level=‘asInvoker’ uiAccess=‘false’” /ManifestFile:“x64\Debug\ProductionModule3D.exe.intermediate.manifest” /NOLOGO /LIBPATH:“C:\OpenCASCADE6.5.3\ros\win64\vc19\lib” /LIBPATH:“C:\boost\1_73_0\stage\lib” /LIBPATH:“C:\Projects\PM3D\PD_PM3D\x64\Debug” /LIBPATH:“C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2020.2.254\windows\mkl\lib\intel64” /LIBPATH:".\twsce\lib\x64\debug" /LIBPATH:“C:\Program Files\Liquid Technologies\Liquid Studio 2020\XmlDataBinder18\Redist18\cpp\win64\lib” /LIBPATH:".\ZipArchive\x64\Debug STL MD" /LIBPATH:“C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\lib\x64” /TLBID:1

CUDA Linker:
“C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\bin\nvcc.exe” -dlink -o x64\Debug\ProductionModule3D.device-link.obj -Xcompiler “/EHsc /nologo /Zi " -L"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\bin/crt” cudart.lib cudadevrt.lib