CUDA’s sample projects uses some automated makefile which is not initially usable by Eclipse.
1. Create Eclipse Makefile Project
2. Modify common.mk
By default, CUDA’s makefile includes common.mk. When I try to use the makefile, Eclipse complains “no target error”
So, I just added “all: $(TARGET)” in the target section in common.mk
Then, I tried Eclipse again. It complains “nvcc” not found. Great. Just modify nvcc into /usr/local/cuda/nvcc
Finally, everything works great.
Be sure that existing projects doesn’t have any side effects by modifying common.mk
–
My environment:
Mac Book Pro (Intel)
OS: OS X 10.5.2 (Leopard)
GPU: 8600M GT 128MB
IDE: Eclipse CDT (eclipse-cpp-europa-winter-macosx-carbon)
June 24, 2008 at 5:40 pm
Could you be a little more specific about the structure of the project in Eclipse? ie. Where does the common.mk fit in? Did you write your own make file? Last, how did you modify the project to point to nvcc? Thanks for your reply. i have the same environment but its driving me nuts.
June 24, 2008 at 8:32 pm
1. Where is common.mk?
The common.mk comes with CUDA SDK
/installed path/CUDA/NVIDIA CUDA SDK/common/common.mk
(XP or Vista version do not have this)
2. Did I write Makefile?
No, I didn’t write any Makefile but I used the same Makefile included in the SDK’s projects. I just put my Eclipse project in the same place with SDK’s projects directory to avoid any relative path problem of Makefile.
3. How to modify the nvcc in the common.mk
If you see the common.mk, you just replace nvcc with /usr/local/cuda/nvcc or your installed path.
4. Another way
Another better way to do this will be using cmake for CUDA
http://www.sci.utah.edu/~abe/FindCuda.html
I haven’t tried this yet, but I heard it works.
July 25, 2008 at 1:35 pm
Thanks for this post! It helped me get Eclipse set up for CUDA in Ubuntu. I did a few things differently, here is my post about it in case anyone is interested:
http://lifeofaprogrammergeek.blogspot.com/2008/07/using-eclipse-for-cuda-development.html