makefile错误:make:***没有规则可以使目标`omp.h';使用OpenMP [英] makefile error: make: *** No rule to make target `omp.h' ; with OpenMP

查看:75
本文介绍了makefile错误:make:***没有规则可以使目标`omp.h';使用OpenMP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所有,我正在使用OpenMP编译C程序.这是我第一次使用makefile.当执行"make"命令时,gcc报告错误make: * 没有规则来创建目标 omp.h',这是 smooth.o'所需要的.停止.但是omp.h在/usr/lib/gcc/i686-linux-gnu/4.6/include/omp.h中,我想知道如何解决它.有人可以帮我吗?谢谢.

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

推荐答案

除非期望标准头文件发生更改,否则最简单的解决方案就是将其从先决条件列表中删除.

Unless you're expecting your standard header files to change, the simplest solution is just to remove them from the prerequisite list(s).

如果您不想执行上述操作,则需要指定 omp.h 的完整路径,或使用

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.

这篇关于makefile错误:make:***没有规则可以使目标`omp.h';使用OpenMP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆