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!
LVL 25
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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 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


Just add '-deviceemu' to that very command line.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.