all, I was compiling a C program with OpenMP. It's my first time to use makefile. When excuting "make", the gcc reports the error make: * No rule to make target omp.h', needed by
smooth.o'. Stop. However the omp.h is in the /usr/lib/gcc/i686-linux-gnu/4.6/include/omp.h , I am wondering how to fix it. Could anyone help me? Thank you.
我正在用OpenMP编译一个C程序。这是我第一次使用makefile。当excuting“make”时,gcc会报告错误:*没有规则制定目标omp。h”,需要bysmooth.o”。停止。然而,经济新闻。h在/usr/lib/gcc/i686-linux-gnu/4.6/include/omp中。我想知道如何修理它。有人能帮助我吗?谢谢你!
CC=gcc
CFLAGS = -fopenmp
all: smooth
smooth: smooth.o ompsooth.o
$(CC) $(CFLAGS) -o smooth smooth.o ompsmooth.o
ompsmooth.o: ompsmooth.c assert.h stdio.h stdlib.h omp.h ompsmooth.h
gcc $(CFLAGS) ompsmooth.c
smooth.o: smooth.c ompsmooth.h omp.h stdio.h stdlib.h string.h sys/types.h sys/stat.h fcntl.h
gcc $(CFLAGS) smooth.c
clean:
rm *.o
rm smooth
1 个解决方案
#1
5
Unless you're expecting your standard header files to change, the simplest solution is just to remove them from the prerequisite list(s).
除非您期望您的标准头文件发生更改,否则最简单的解决方案就是将它们从先决条件列表中删除。
If you don't want to do the above, then you'll either need to specify the complete path to omp.h
, or use the VPATH
mechanism.
如果您不想执行上述操作,那么您可能需要指定omp的完整路径。h,或者使用VPATH机制。
#1
5
Unless you're expecting your standard header files to change, the simplest solution is just to remove them from the prerequisite list(s).
除非您期望您的标准头文件发生更改,否则最简单的解决方案就是将它们从先决条件列表中删除。
If you don't want to do the above, then you'll either need to specify the complete path to omp.h
, or use the VPATH
mechanism.
如果您不想执行上述操作,那么您可能需要指定omp的完整路径。h,或者使用VPATH机制。