Reputation: 43
When the cuda_test.cu
file is not included in the project, the code runs fine.
When such a file is included, I receive the following error message
mfcs100u.lib(dllmodul.obj) : error LNK2005: DllMain already defined in MSVCRT.lib(dllmain.obj)
cuda_test.c
u has the following header files, a global function and a wrapper.
#include <cuda.h>
#include <cuda_runtime.h>
#include <device_launch_parameters.h>
So I am not sure what causes this problem.
After some research, it seems this problem is fairly common and has fixes. But this starts giving trouble in a different part of the code. ("StdAfx.h" is included in all .cpp files, if this information is relevant).
It is a huge project written in C++ and I am trying to parallelize some parts of it.
Some help will be hugely appreciated. I can give extra details if needed.
Upvotes: 2
Views: 1976
Reputation: 15744
You need to make sure that all parts of your app link against the same runtime.
In Solution Explorer, right click your .cu
file and select Properties. Go to CUDA C/C++ > Host
and make sure that Runtime Library
is set to the same as for the rest of your project.
Upvotes: 1