I indicated that what I had done was on linux. You will need to modify it for cygwin. You’ve already discovered the .o → .obj difference on linux vs. windows (for nvcc). Note that the nvcc you are using on windows is designed to be compatible with visual studio, not cygwin (which is why g++ in this case creates the .o file but nvcc creates the .obj file).
You also need to fix this path:
-L/usr/local/cuda/lib64
to match whatever is the path to your cudart.lib file on your machine.
If you’re not sure what that path is, use the windows file search utility to locate it.
Even if you make that change, it’s possible that it may still not work. As I mentioned, nvcc is designed to be compatible with visual studio on windows, not cygwin. There may be other linker discrepancies or other issues that prevent it from working properly.
The solution would be to switch to a supported linux environment.