Pregunta

I have made a makefile in order to compile my files:

CFLAGS        = -O3 -Wall -I /usr/local/cuda/include/ 
NVCCFLAGS     = -O3 -arch sm_20
LDFLAGS       = -O3 -L/usr/local/cuda/lib64 -lcudart
EXE           =  runAPP

app.o:app.cu
$(NVCC) $(NVCCFLAGS) -c $< -o $(CPPFLAGS) $(LIB_PATH) $(LDFLAGS) $@

$(EXE): app.o 
    $(NVCC) $(NVCCFLAGS) $(CFLAGS) $(LDFLAGS) -o $@  $(CPPFLAGS) $(LIB_PATH) app.o  \
        -lANN_char -lz
    cp $@ ../bin

But I got this problem:

app.cpp:26:26: error: cuda_runtime.h: No such file or directory app.cpp:27:18: error: cuda.h: No such file or directory

This is how I include them in the app.cpp:

#include <cuda.h>
#include <cuda_runtime.h>

Why is this problem?

I search something on google, they said that the app.cpp must be always app.cu, is it true?

Thanks in advance.

¿Fue útil?

Solución

If your makefile, you have:

CFLAGS        = -O3 -Wall -I /usr/local/cuda/include/ 
NVCCFLAGS     = -O3 -arch sm_20
LDFLAGS       = -O3 -L/usr/local/cuda/lib64 -lcudart
EXE           =  runAPP

app.o:app.cu $(NVCC) $(NVCCFLAGS) -c $< -o $(CPPFLAGS) $(LIB_PATH) $(LDFLAGS) $@

CPPFLAGS should be expanding to nothing; try changing it to CFLAGS, or change CFLAGS to CPPFLAGS.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top