Makefile is giving me an error - No such file or directory
c++, makefile
Solution
`Test` should be the argument to `-o`:
Test: BaseClass.o DerivedClass.o Test.o
g++ -o Test BaseClass.o DerivedClass.o Test.o
Notice I moved `Test` from the end of the line to immediately after `-o`.
Problem
I have a very simple makefile. All I want to do in this makefile is compile my files and create an executable for my test. I have the following files: - Test.cpp - main function - BaseClass.cpp - BaseClass.h - header file for the Base class - DerivedClass.cpp - Inherits the base class - DerivedClass.h - header file for the derived class Here is the makefile I have: ``` all: Test Test: BaseClass.o DerivedClass.o Test.o g++ -o BaseClass.o DerivedClass.o Test.o Test Test.o: Test.cpp BaseClass.h DerivedClass.h g++ -c Test.cpp Package.o: BaseClass.cpp BaseClass.h g++ -c BaseClass.cpp DerivedClass.o: DerivedClass.cpp DerivedClass.h g++ -c DerivedClass.cpp clean: rm -rf *.o ``` I've never created a makefile for 5 files before. I can create one with 3 pretty easily, but I don't know what's wrong. The error I'm getting is: Test: No fuch file or directory EDIT: Thanks, Joe! That was it. Pretty silly oversight of mine.