我的Makefile是这样的:
from dual
我的主:
execute: Main.o Student.o Course.o Enrollment.o PrintData.o StoreData.o LoadData.o
g++ -o execute Main.o Student.o Course.o Enrollment.o PrintData.o StoreData.o LoadData.o
Main.o: Main.cpp Student.h Course.h Enrollment.h PrintData.h StoreData.h LoadData.h
g++ -c Main.cpp
Student.o: Student.cpp Student.h
g++ -c Student.cpp
Course.o: Course.cpp Course.h
g++ -c Course.cpp
Enrollment.o: Enrollment.cpp Student.h Course.h Enrollment.h
g++ -c Enrollment.cpp
PrintData.o: PrintData.cpp Student.h Course.h Enrollment.h PrintData.h
g++ -c PrintData.cpp
StoreData.o: StoreData.cpp Student.h Course.h Enrollment.h StoreData.h
g++ -c StoreData.cpp
LoadData.o: LoadData.cpp Student.h Course.h Enrollment.h LoadData.h
g++ -c LoadData.cpp
clean:
rm *.o execute
run:
make execute && ./execute
Student.cpp:
#include "Student.h"
#include "Course.h"
#include "Enrollment.h"
#include "PrintData.h"
#include "StoreData.h"
#include "LoadData.h"
Course.cpp:
#include "Student.h"
Enrollment.cpp:
#include "Course.cpp"
PrintData.cpp:
#include "Enrollment.h"
#include "Course.h"
#include "Student.h"
StoreData.cpp:
#include "Enrollment.h"
#include "Student.h"
#include "Course.h"
#include "PrintData.h"
LoadData.cpp
#include "Enrollment.h"
#include "Student.h"
#include "Course.h"
#include "StoreData.h"
我无法运行我的make文件进行编译吗?它一直在给我“没事做”或“没有指定目标,也没有找到makefile。停止”。请帮助
答案 0 :(得分:0)
重命名您的Makefile或使用手册中提到的-f
选项:
-f file, --file=file, --makefile=FILE Use file as a makefile.
make在makefile中执行命令以更新一个或多个目标 名称,其中名称通常是一个程序。如果不存在-f选项, make将查找makefile文件GNUmakefile,makefile和Makefile, 以此顺序。