# Using Async Thrust Functions in Windows

**URL:** <https://forums.developer.nvidia.com/t/using-async-thrust-functions-in-windows/109026>\
**Category:** CUDA Programming and Performance\
**Created:** [December 12, 2019, 2:35pm UTC](https://forums.developer.nvidia.com/t/using-async-thrust-functions-in-windows/109026 "2019-12-12T14:35:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![akifcorduk](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@akifcorduk](https://forums.developer.nvidia.com/u/akifcorduk)\
**Post date:** [December 12, 2019, 2:35pm UTC](https://forums.developer.nvidia.com/t/using-async-thrust-functions-in-windows/109026/1 "2019-12-12T14:35:03Z")

</div>

I need to use some async gather operations(I know async gather is not implemented yet and it uses transform in the backend). I intend to use thrust::async::transform, however I cannot build the code in Visual Studio. The reason is most probably THRUST\_CPP\_DIALECT and THRUST\_LEGACY\_GCC directives. My question: is it possible to use async transform in Windows or can I trick thrust by changing the values of THRUST\_CPP\_DIALECT and THRUST\_LEGACY\_GCC?

---

<div class="post-metadata">

**Author:** ![etvixi](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/etvixi/32/15209_2.png) [@etvixi](https://forums.developer.nvidia.com/u/etvixi)\
**Post date:** [February 21, 2020, 2:47pm UTC](https://forums.developer.nvidia.com/t/using-async-thrust-functions-in-windows/109026/2 "2020-02-21T14:47:59Z")

</div>

Thrust uses ` __cplusplus` macro definition, thus you need to add `/Zc:__ cplusplus` compiler flag for cpp-files (for MSVC), and `-Xcompiler="/Zc:__cplusplus"` for cu-files (i.e., for NVCC).

If you use CMake to generate MSBuild project, then the correct way to add NVCC flag per executable/library is `target_compile_options(your_library_name PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler="/Zc:__cplusplus">)`
