modify Makefile in samples get errors

i am a newbie,now i can compile the samples correctly as Guide.pdf.i cp the deviceQuery.cpp and Makefile to home directory,and i edit the Makefile like this

# Add source files here

EXECUTABLE      := deviceQuery

# Cuda source files (compiled with cudacc)

CUFILES         :=

# C/C++ source files (compiled with gcc / c++)

CCFILES         := deviceQuery.cpp

################################################################################

# Rules and targets

include ~/NVIDIA_GPU_Computing_SDK/C/common/common.mk

LIB += -lcuda

,i just change the “include…” line

include ../../common/common.mk

.But when i compile get errors.

$make

deviceQuery.cpp:14:22: error: shrUtils.h: there is no this file or dirctory

deviceQuery.cpp:15:23: error: shrQATest.h: there is no this file or dirctory

deviceQuery.cpp:24:26: error: cutil_inline.h: there is no this file or dirctory

deviceQuery.cpp: In function ‘void getCudaAttribute(T*, CUdevice_attribute, int)’:

....

I suppose the Makefile can be Portable。

Hi
Normally, you are not supposed to use the SDK’s example makefiles outside of the SDK structure since they are rather coupled. So go to ~/NVIDIA_GPU_Computing_SDK/C/src/deviceQuery and type “make”. I’m not sure whether the dependencies are well handled, so if it fails for some missing shrutil library, try to go to ~/NVIDIA_GPU_Computing_SDK/shared and type “make”.
You can also compile all the examples in one go by going to ~/NVIDIA_GPU_Computing_SDK and typing “make”.

thank you for your reply:)i can compile the samplesin ~/NVIDIA_GPU_Computing_SDK/C/src/ correctly as Guide.pdf.If i want to compile myprogram (in ~/works)with Makefile ,can i depend on the above Makefile?and how edit it?

I would strongly discourage you to do so. You’d be much better starting from your own Makefile, outside of the SDK structure.

External Image i will try start independent,thank you for your recommend,so do you know any simple and representative one .

Here is one tinkered just now (might need to correct typos).

Just adjust your compiler options, file names, and that should do it for a start.

(Take care that the white spaces starting lines are actually TABs)

CC=nvcc

CCFLAGS=-arch=sm_20 --ptxas-options "--verbose"

EXE=mybin

SRCS=foo.cu bar.cu

OBJS=foo.o bar.o

all: $(EXE) 

$(EXE): $(OBJS) 

    $(CC) $(CCFLAGS) -o $@ $(OBJS)

.SUFFIXES: .cu .o

%.o: %.cu

    $(CC) -c $(CCFLAGS) -o $@ $<

.PHONY: clean

clean:

    rm -f $(EXE) $(OBJS)

]

thankyou very much,sorry for reply later