我写了一个c ++项目,它可以在eclipse中正常工作.但是当尝试用makefile编译时,我得到一个错误.当我搜索此错误时,所有解决方案建议添加主要功能.我在matrixU.cpp中有一个main函数.
这是make文件:
# All Targets
all: matrixU
# Tool invocations
# Executable "matrixU" depends on the files matrixU.o and Student.o and Course.o
matrixU: bin/matrixU.o bin/Student.o bin/Course.o
@echo 'Building target: matrixU'
@echo 'Invoking: C++ Linker'
g++ -o bin/matrixU.o bin/Student.o bin/Course.o
@echo 'Finished building target: matrixU'
@echo ' '
# Depends on the source and header files
bin/matrixU.o: src/matrixU.cpp include/matrixU.h
g++ -g -Wall -Weffc++ -c -Linclude -o bin/matrixU.o src/matrixU.cpp
# Depends on the source and header files
bin/Student.o: src/Student.cpp include/Student.h
g++ …Run Code Online (Sandbox Code Playgroud)