makefile error: make: *** No rule to make target `omp.h' ; with OpenMP

旧巷老猫 提交于 2021-02-10 19:52:44

问题


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 bysmooth.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.

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:


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.



来源:https://stackoverflow.com/questions/14924683/makefile-error-make-no-rule-to-make-target-omp-h-with-openmp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!