问题
To compile my source correctly on Windows, I need to pass the EHs
flag to MSVC. This is usually straight forward:
cl -EHs -c ...
When building for GPU acceleration, I need nvcc
to pass this flag along when it invokes cl
under the hood. I simply do:
nvcc -dc -ccbin cl -Xcompiler -EHs ...
yet cl
throws a warning:
warning C4297: 'someFuncInMyCode': function assumed not to throw an exception but does
note: The function is extern "C" and /EHc was specified
It seems cl
receives the flag EHc
, instead of EHs
, igoring my flag passed through -Xcompiler
. There is no warning from MSVC that my EHs
argument was overridden.
How can I prevent nvcc from passing EHc
(if that's indeed happening), otherwise is there a mistake in my forwarding of cl
flags?
来源:https://stackoverflow.com/questions/61175954/nvcc-overriding-a-msvc-flag-ehs