# CMake CUDA dynamic parallelism LINK2001 error

**URL:** <https://forums.developer.nvidia.com/t/cmake-cuda-dynamic-parallelism-link2001-error/56932>\
**Category:** CUDA Programming and Performance\
**Created:** [January 10, 2018, 3:16pm UTC](https://forums.developer.nvidia.com/t/cmake-cuda-dynamic-parallelism-link2001-error/56932 "2018-01-10T15:16:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tknv](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@tknv](https://forums.developer.nvidia.com/u/tknv)\
**Post date:** [January 10, 2018, 3:16pm UTC](https://forums.developer.nvidia.com/t/cmake-cuda-dynamic-parallelism-link2001-error/56932/1 "2018-01-10T15:16:32Z")

</div>

Hello there,  
I am new to CUDA and CMake programming and set up my first project in Visual Studio.

```auto
project(cuNSearch LANGUAGES CXX CUDA)
# Visual studio solution directories.
set_property(GLOBAL PROPERTY USE_FOLDERS on)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

SET(CMAKE_DEBUG_POSTFIX "_d")

# CUDA
set (CUDA_HEADER_FILES 
         include/CuNSearch.cuh)
		 
set (CUDA_SOURCE_FILES 
         src/CuNSearch.cu)

set (HEADER_FILES 
		include/Config.h
		include/PointSet.h
		include/ActivationTable.h
		Utils/helper_cuda.h
		Utils/helper_math.h
		Utils/helper_string.h
		Utils/Timing.h
		Utils/IDFactory.h)

set (SOURCE_FILES 
		Utils/Timing.cpp
		Utils/IDFactory.cpp)
			
file(GLOB CUDA_FILES "src/" *.cu)

include_directories(
	"include"
	"Utils"
	${CUDA_INCLUDE_DIRS} 
	${CUDA_CUT_INCLUDE_DIR})

add_library(cuNSearch STATIC ${HEADER_FILES} ${SOURCE_FILES})
add_library(cudacuNSearch STATIC ${CUDA_HEADER_FILES} ${CUDA_SOURCE_FILES})
	target_link_libraries(cudacuNSearch cudart ${CUDA_LIBRARIES})
set_target_properties( cudacuNSearch
                      PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
set_target_properties( cudacuNSearch
                       PROPERTIES CUDA_RESOLVE_DEVICE_SYMBOLS ON)
target_link_libraries(cuNSearch cudacuNSearch)
				 
install(FILES "include/cuNSearch" ${HEADER_FILES}
	DESTINATION include/)

install(TARGETS cuNSearch
	RUNTIME DESTINATION bin
	LIBRARY DESTINATION lib
	ARCHIVE DESTINATION lib)

option(BUILD_DEMO "Build example of how to use this library."
		ON)
if(BUILD_DEMO)
	add_subdirectory(demo)
endif(BUILD_DEMO)
string(APPEND CMAKE_CUDA_FLAGS " -gencode=arch=compute_50,code=sm_50 " )

```

```auto
include_directories("../include")

add_executable(Demo
    main.cpp
)

target_link_libraries(Demo cuNSearch)

```

The code using seperable compilation compiles fine, but the linking with the executable throws the following error:

Error LNK2001 unresolved external symbol \_\_fatbinwrap\_66\_tmpxft\_000009c4\_00000000\_16\_cuda\_device\_runtime\_compute\_70\_cpp1\_ii\_8b1a5d37 Demo …\Desktop\Cunsearch\build\demo\cudacuNSearch.lib(cudacuNSearch.device-link.obj) 1

I hope that I provided all the necessary information.  
CUDA 9.0  
VS 15.4.4  
Cmake 3.9.6
