Question

Why can't my makefile compiled? My Makefile is like this: execute: Main.o Student.o Course.o Enrollment.o PrintData.o...

Why can't my makefile compiled?

My Makefile is like this:

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

My main:

#include "Student.h"
#include "Course.h"
#include "Enrollment.h"
#include "PrintData.h"
#include "StoreData.h"
#include "LoadData.h"

Student.cpp : #include "Student.h"

Course.cpp: #include "Course.cpp"

Enrollment.cpp: #include "Enrollment.h"
#include "Course.h"
#include "Student.h"

PrintData.cpp:

#include "Enrollment.h"
#include "Student.h"
#include "Course.h"
#include "PrintData.h"

StoreData.cpp:

#include "Enrollment.h"
#include "Student.h"
#include "Course.h"
#include "StoreData.h"

LoadData.cpp

#include "Enrollment.h"
#include "Student.h"
#include "Course.h"
#include "LoadData.cpp"

I cant run my make file to compile? It keeps giving me "Nothing to be done", or "No targets specificed and no makefile found. Stop". Please help

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Solution:

Executed this makefile by creating the (dummy)required files..

Makefile is working fine. As mentioned in the please check the path for the files required by the makeFile.

Screenshots:

Output:

1) Before make...

make

3) After make..

As you can see that the object file(Main.o) is created in the current directory. So please make sure the required files are present in the same directory.. or else the path for those is mentioned correctly..

----------------------------------------------------------------------------

Please comment if you have any queries on this solution..

Add a comment
Know the answer?
Add Answer to:
Why can't my makefile compiled? My Makefile is like this: execute: Main.o Student.o Course.o Enrollment.o PrintData.o...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I am receiving an "undefined reference to" build error in my code that i do not...

    I am receiving an "undefined reference to" build error in my code that i do not know how to fix. Here is my main code in C++ (the line of code that is in question is in bold): #include <iostream> #include<iomanip> #include<stdio.h> #include<stdlib.h> using namespace std; //Prototypes of functions void sortTestScores(int*testScores,int size); double averageTestScore(int*testScores,int size); void printTestScores(int*testScores, int size); int main() { //variable declaration int *testScores; int size; int score; double average; //Prompt to enter size of array cout<<"Enter size...

  • permute zip contains: makefile: DIR=${PWD} ASST=$(notdir ${DIR}) MAINPROG=pdriver ifneq (,$(findstring MinGW,$(PATH))) DISTR=MinGW EXE=.exe LFLAGS= else DISTR=Unix...

    permute zip contains: makefile: DIR=${PWD} ASST=$(notdir ${DIR}) MAINPROG=pdriver ifneq (,$(findstring MinGW,$(PATH))) DISTR=MinGW EXE=.exe LFLAGS= else DISTR=Unix EXE= LFLAGS= endif # ######################################################################## # Macro definitions for "standard" C and C++ compilations # CPPFLAGS=-g -D$(DISTR) CFLAGS=-g TARGET=$(MAINPROG)$(EXE) CPPS=pdriver.cpp permute.cpp LINK=g++ $(CPPFLAGS) # CC=gcc CXX=g++ # # # In most cases, you should not change anything below this line. # # The following is "boilerplate" to set up the standard compilation # commands: # OBJS=$(CPPS:%.cpp=%.o) DEPENDENCIES = $(CPPS:%.cpp=%.d) %.d: %.cpp    touch $@...

  • Execute your program like this: C:\> java Lab4 10000ints.txt 172822words.txt Be sure to put the ints...

    Execute your program like this: C:\> java Lab4 10000ints.txt 172822words.txt Be sure to put the ints filename before the words filename. The starter file will be expecting them in that order. Lab#4's main method is completely written. Do not modify main. Just fill in the methods. Main will load a large arrays of int, and then load a large array of Strings. As usual the read loops for each file will be calling a resize method as needed. Once the...

  • please Code in c++ Create a new Library class. You will need both a header file...

    please Code in c++ Create a new Library class. You will need both a header file and a source file for this class. The class will contain two data members: an array of Book objects the current number of books in the array Since the book array is moving from the main.cc file, you will also move the constant array size definition (MAX_ARR_SIZE) into the Library header file. Write the following functions for the Library class: a constructor that initializes...

  • I need help with my C coding homework. If possible can you please comment to help...

    I need help with my C coding homework. If possible can you please comment to help me understand whats going on in the code. Thanks in advance. Create a C program (3 points): o At the top of the file include the following comments: Your name The purpose (core concept found below) of the program The date created o Create two int variables: Initialize each to different values. o Create three pointers: Point the first two pointers to the first...

  • Lab 3 Step One First, create an empty directory for lab3. There is no starter code for this lab. You will be throwing an...

    Lab 3 Step One First, create an empty directory for lab3. There is no starter code for this lab. You will be throwing and catching exceptions in this exercise. Create a file called RuntimeException.h and put the following code in it. #include <string> class RuntimeException { private: string errorMsg; public: RuntimeException(const string& err) { errorMsg = err; } string getMessage() const { return errorMsg; } } Step Two In a new .cpp file in your directory, write a main function...

  • Lab 3 Step One First, create an empty directory for lab3. There is no starter code...

    Lab 3 Step One First, create an empty directory for lab3. There is no starter code for this lab. You will be throwing and catching exceptions in this exercise. Create a file called RuntimeException.h and put the following code in it. #include <string> class RuntimeException { private: string errorMsg; public: RuntimeException(const string& err) { errorMsg = err; } string getMessage() const { return errorMsg; } } Step Two In a new .cpp file in your directory, write a main function...

  • Need C++ coding for this lab exercise given below :) 4. Lab Exercise — Templates Exercise...

    Need C++ coding for this lab exercise given below :) 4. Lab Exercise — Templates Exercise 1 - Function Templating For this part of the lab make a template out of the myMax function and test it on different data types. Copy maxTemplate.cpp to your Hercules account space. Do that by: Entering the command:cp /net/data/ftp/pub/class/115/ftp/cpp/Templates/maxTemplate.cpp maxTemplate.cpp Compile and run the program to see how it works. Make a template out of myMax. Don't forget the return type. Modify the prototype appropriately. Test your myMax template on int, double,...

  • Writing Unix Utilities in C (not C++ or C#) my-cat The program my-cat is a simple...

    Writing Unix Utilities in C (not C++ or C#) my-cat The program my-cat is a simple program. Generally, it reads a file as specified by the user and prints its contents. A typical usage is as follows, in which the user wants to see the contents of my-cat.c, and thus types: prompt> ./my-cat my-cat.c #include <stdio.h> ... As shown, my-cat reads the file my-cat.c and prints out its contents. The "./" before the my-cat above is a UNIX thing; it...

  • okay so here is my c++ code and the errors im really stuck on fixing what...

    okay so here is my c++ code and the errors im really stuck on fixing what i did wrong it seems to be the same repeated error our job is to write a menu driven program that can convert to display Morse Code ere is the menu the program should display Menu Alphabet Initials N-Numbers - Punctuations S = User Sentence Q- Quit Enter command the user chooses A your program should use a loop and your morse code printing...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT