nvcc on Cygwin Obtaining exe file in cygwin

I have compiled a .cu program in cygwin with cl.exe. Every thing seems to be alright. I obtained a .cu.c file. How can I get an .exe file now?

Thanks a lot,
Mosafer

What about your compiler command line?

And you can find the commands of the nvcc or how to compile the .cu file in the nvcc.doc (CUDA 2.0beta/doc).

Thanks for the reply.

I used this command:

nvcc --compiler-bindir=c:/Program\ Files/Microsoft\ Visual\ Studio\ 8/VC/bin -I c:/Program\ Files/NVIDIA\ Corporation/NVIDIA\ CUDA\ SDK/common/inc -keep -cuda simpleTexture.cu

It works without error but I am not seeing any exe file there.

Thanks

It is because you are specifying the -cuda option. That option produces .cu.c output, what you want is -link (which is the default).

nvcc.exe -ccbin “C:\Program Files\Microsoft Visual Studio 8\VC\bin” -deviceemu -link -D_DEBUG -DWIN32 -D_CONSOLE -D_MBCS -Xcompiler /EHsc,/W3,/nologo,/Wp64,/Od,/Zi,/RTC1,/MTd -IC:\CUDA\include -I./ -I"C:\Program Files NVIDIA Corporation\NVIDIA CUDA SDK\common\inc" simpleTexture.cu

the -link command is used to link the obj into a exe file:)

BTY, you it’s not necessary to use cygwin to run the command. The CMD console is ok:)

Thanks a lot for the comments.

Now I receive some error regarding linking:

tmpxft_00000b60_00000000-6.i
tmpxft_00000b60_00000000-7.obj : error LNK2019: unresolved external symbol __imp__cutCheckCmdLineFlag@12 referenced in function _main
tmpxft_00000b60_00000000-7.obj : error LNK2019: unresolved external symbol __imp__cutFree@4 referenced in function __Z7runTestiPPc
tmpxft_00000b60_00000000-7.obj : error LNK2019: unresolved external symbol __imp__cutWriteFilef@20 referenced in function __Z7runTestiPPc
tmpxft_00000b60_00000000-7.obj : error LNK2019: unresolved external symbol __imp__cutSavePGMf@16 referenced in function __Z7runTestiPPc
tmpxft_00000b60_00000000-7.obj : error LNK2019: unresolved external symbol __imp__cutDeleteTimer@4 referenced in function __Z7runTestiPPc
tmpxft_00000b60_00000000-7.obj : error LNK2019: unresolved external symbol __imp__cutGetTimerValue@4 referenced in function __Z7runTestiPPc
tmpxft_00000b60_00000000-7.obj : error LNK2019: unresolved external symbol __imp__cutStopTimer@4 referenced in function __Z7runTestiPPc
tmpxft_00000b60_00000000-7.obj : error LNK2019: unresolved external symbol __imp__cutStartTimer@4 referenced in function __Z7runTestiPPc
tmpxft_00000b60_00000000-7.obj : error LNK2019: unresolved external symbol __imp__cutCreateTimer@4 referenced in function __Z7runTestiPPc
tmpxft_00000b60_00000000-7.obj : error LNK2019: unresolved external symbol __imp__cutLoadPGMf@16 referenced in function __Z7runTestiPPc
tmpxft_00000b60_00000000-7.obj : error LNK2019: unresolved external symbol __imp__cutFindFilePath@8 referenced in function __Z7runTestiPPc
a.exe : fatal error LNK1120: 11 unresolved externals

Thanks
Mosafer

The -L command is need to add the libs into the project.

You can find the command in the nvcc manual:)

just like:
nvcc.exe -ccbin “C:\Program Files\Microsoft Visual Studio 8\VC\bin” -deviceemu -link -D_DEBUG -DWIN32 -D_CONSOLE -D_MBCS -Xcompiler /EHsc,/W3,/nologo,/Wp64,/Od,/Zi,/RTC1,/MTd -IC:\CUDA\include -I./ -I"C:\Program Files NVIDIA Corporation\NVIDIA CUDA SDK\common\inc" -L"C:\CUDA\lib" -L"C:\Program Files\NVIDIA Corporation\NVIDIA CUDA SDK\common\lib" simpleTexture.cu

Thanks for the comments.
I am still getting the same errors. I am reading the documentation and I can’t figure out the problem.

Can you send me your simple cu file?

The program I am trying to run is one of the CUDA’s examples located on projects/ directory (simpleTexture.cu).

  • -! I guess this is a bug- -!

If there is any space in the -L command line, it can’t work!sigh!

So first you should copy the cutil32.lib file to the C:\CUDA\lib\ category.

then use the command line below, you can see a.exe be created!

nvcc.exe -ccbin “C:\Program Files\Microsoft Visual Studio 8\VC\bin” -deviceemu -link -D_DEBUG -DWIN32 -D_CONSOLE -D_MBCS -Xcompiler /EHsc,/W3,/nologo,/Wp64,/Od,/Zi,/RTC1,/MTd -IC:\CUDA\include -I./ -I"C:\Program Files\NVIDIA Corporation\NVIDIA CUDA SDK\common\inc" -l"C:\CUDA\lib\cudart" -l"C:\CUDA\lib\cutil32" simpleTexture.cu

:no: so sigh about the “space” - !