Use of iostream in .cu files ? (VC++ 2008) Conflict between LIBCMT and libcpmtd libraries...


I’m trying to compile my first CUDA program on windows with VC++ 2008. But I have a problem with using iostream.

All my code is in a .cu file and thus compiled with nvcc. I’m in debug mode.

I could add a try catch close in my main without problem.
But when I include iostream and cout or cerr instructions I have an error in the link.
It complains of conflicts between LIBCMT and functions in the libcpmtd library.

Since I’m compiling in debug mode, where is the libcmt dependency coming from ?
All I did was adding #include and a std::cout << “blablab” << std::endl; instruction in the .cu file.

I finally solved it after trying many combinations.

I use the cuda vs wizard.

In the property page, there is a specific CUDA entry where we can define the nvcc compile options.

In the backends subsection, I added /MTd in the compiler and linker options.
Now it works and prints out nice messages using the cout and cerr stream.