Warning, conflict with "clock"


I got a “conflict with clock” warning after switching from building a multi-threaded RT lib (/MD) to a multi threaded DLL (/MD) or multi threaded debug DLL (/MDd).

I want to pack some cuda functions into a DLL. After coding all functions and testing as standalone app I tried to but some functions into a dll and load it from a tester app.

One of these functions are the “printDeviceInfo” example:

NVCC call:

(CUDA_BIN_PATH)\nvcc.exe -ccbin "(VCInstallDir)bin" -deviceemu -c -D_DEBUG -DWIN32 -DIOCALC_EXPORTS -D_CONSOLE -D_MBCS -Xcompiler /EHsc,/W3,/nologo,/Wp64,/Od,/Zi,/RTC1,/MDd -I"(CUDA_INC_PATH)" -I./ -o (ConfigurationName)\printDeviceInfo.obj printDeviceInfo.cu

Warning message:

1>“j:\cuda\include\common_functions.h”, line 55: warning: dllexport/dllimport
1> conflict with “clock” (declared at line 176 of
1> “J:\Programme\Microsoft Visual Studio 8\VC\INCLUDE\time.h”);
1> dllimport/dllexport dropped
1> extern __declspec(host) __declspec(device) clock_t clock(void) ;

Any ideas?


It is a known bug.
It is just a warning, the DLL will work just fine (same thing happens when building Matlab mex files).

Okay, sounds good, thanks for the reply!


using CUDA 1.1 with Matlab didn’t report any error messages, but having installed a new driver and CUDA 2.1 I also get the “conflict with clock” messages when compiling mex files! What changed?


Your -Xcompiler string has the /MDd option set. This will cause the code nvcc sloughs off to the cl compiler to try to dynamically link with the C runtime libraries. If your general project settings are for statically linking, /MTd, the warning message you got is displayed. Having this conflict will cause other errors to happen when you try to compile for the emulator.