[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 611
  • Last Modified:

Custom Build Step in Visual Studio?


after months of procrastinating, I've finally installed CUDA and have successfully compiled a simple CUDA application in Visual Studio 2008. However, as I don't have a CUDA-enabled GPU on this machine, I need to run the code using an emulator.

According to here:
I merely need to "add the following option to the Custom Build Step command line: -deviceemu".

However, as a newbie to C (and particularly VS) I have no idea how to do this. Can someone guide me please?

I know where the Cuda.Rules file is (which I've added to the project already) if that helps...

Thank you!
1 Solution
It's explained in detail just a bit before that '-deviceemu' thingy:


In its default configuration, Visual C++ doesn’t know how to compile .cu file. It has to be told explicitly how to do this using a Custom Build Step. This is done by right-clicking on the example1.cu file and selecting Properties from the drop-down menu. In the Property Pages window that appears, set the Custom Build Step command line as follows:

    Configuration Properties ¿ Custom Build Step ¿ General:
    Command Line =
    “$(CUDA_BIN_PATH)\nvcc.exe” -ccbin “$(VCInstallDir)bin” -c -D_DEBUG -DWIN32 -D_CONSOLE -D_MBCS -Xcompiler /EHsc,/W3,/nologo,/Wp64,/Od,/Zi,/MTd -I”$(CUDA_INC_PATH)” -I./ -o $(ConfigurationName)\example1.obj example1.cu


Just add '-deviceemu' to that very command line.
InteractiveMindAuthor Commented:
Sorted, thanks, jkr.

Unfortunately though, I'm having other problems (hopefully unrelated) whilst executing the code, for which I shall post a new thread.

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now