Skip to main content
deleted 42 characters in body
Source Link
Rui F Ribeiro
  • 58k
  • 28
  • 156
  • 237

(Please bear with me as I'm new to this) I'm working on a makefile for a simple program and it has two files associated with it: main.cpp and game.adt. From game.adt I'm supposed to split it into 2 parts for the header and source code (guess.h and guess.cpp) using csplit. I've tried compiling the makefile like this:

HEADERS=guess.h

#Targets:

default: guessGame

guessGame: guess.o main.o
       
                g++ guess.o main.o -o guessGame

guess.o: guess.cpp $(HEADERS) 

                g++ -c guess.cpp -o guess.o

main.o: main.cpp $(HEADERS)

         g++ -c main.cpp -o main.o

clean:

       -rm -f guessGame *.o

However it says there's 'no rule for target guess.cpp needed for guess.o.' Same goes for the header file. I know it's because the files 'guess.cpp' and 'guess.h' don't exist but it's because I'm supposed to split the .adt file to make it into guess.cpp and guess.h. How do I create a rule then for targets guess.cpp and guess.h using the adt file?

(Please bear with me as I'm new to this) I'm working on a makefile for a simple program and it has two files associated with it: main.cpp and game.adt. From game.adt I'm supposed to split it into 2 parts for the header and source code (guess.h and guess.cpp) using csplit. I've tried compiling the makefile like this:

HEADERS=guess.h

#Targets:

default: guessGame

guessGame: guess.o main.o
       
                g++ guess.o main.o -o guessGame

guess.o: guess.cpp $(HEADERS) 

                g++ -c guess.cpp -o guess.o

main.o: main.cpp $(HEADERS)

         g++ -c main.cpp -o main.o

clean:

       -rm -f guessGame *.o

However it says there's 'no rule for target guess.cpp needed for guess.o.' Same goes for the header file. I know it's because the files 'guess.cpp' and 'guess.h' don't exist but it's because I'm supposed to split the .adt file to make it into guess.cpp and guess.h. How do I create a rule then for targets guess.cpp and guess.h using the adt file?

I'm working on a makefile for a simple program and it has two files associated with it: main.cpp and game.adt. From game.adt I'm supposed to split it into 2 parts for the header and source code (guess.h and guess.cpp) using csplit. I've tried compiling the makefile like this:

HEADERS=guess.h

#Targets:

default: guessGame

guessGame: guess.o main.o
       
                g++ guess.o main.o -o guessGame

guess.o: guess.cpp $(HEADERS) 

                g++ -c guess.cpp -o guess.o

main.o: main.cpp $(HEADERS)

         g++ -c main.cpp -o main.o

clean:

       -rm -f guessGame *.o

However it says there's 'no rule for target guess.cpp needed for guess.o.' Same goes for the header file. I know it's because the files 'guess.cpp' and 'guess.h' don't exist but it's because I'm supposed to split the .adt file to make it into guess.cpp and guess.h. How do I create a rule then for targets guess.cpp and guess.h using the adt file?

improved formating
Source Link
steeldriver
  • 83.8k
  • 12
  • 124
  • 175

(Please bear with me as I'm new to this) I'm working on a makefile for a simple program and it has two files associated with it: main.cpp and game.adt. From game.adt I'm supposed to split it into 2 parts for the header and source code (guess.h and guess.cpp) using csplit. I've tried compiling the makefile like this:

HEADERS=guess.h

#Targets:

default: guessGame

guessGame: guess.o main.o

HEADERS=guess.h

#Targets:

default: guessGame

guessGame: guess.o main.o
       
                g++ guess.o main.o -o guessGame

guess.o: guess.cpp $(HEADERS)


guess.o: guess.cpp $(HEADERS) 

                g++ -c guess.cpp -o guess.o

main.o: main.cpp $(HEADERS)


main.o: main.cpp $(HEADERS)

         g++ -c main.cpp -o main.o

clean:


clean:

       -rm -f guessGame *.o

However it says there's 'no rule for target guess.cpp needed for guess.o.' Same goes for the header file. I know it's because the files 'guess.cpp' and 'guess.h' don't exist but it's because I'm supposed to split the .adt file to make it into guess.cpp and guess.h. How do I create a rule then for targets guess.cpp and guess.h using the adt file?

(Please bear with me as I'm new to this) I'm working on a makefile for a simple program and it has two files associated with it: main.cpp and game.adt. From game.adt I'm supposed to split it into 2 parts for the header and source code (guess.h and guess.cpp) using csplit. I've tried compiling the makefile like this:

HEADERS=guess.h

#Targets:

default: guessGame

guessGame: guess.o main.o

            g++ guess.o main.o -o guessGame

guess.o: guess.cpp $(HEADERS)

            g++ -c guess.cpp -o guess.o

main.o: main.cpp $(HEADERS)

     g++ -c main.cpp -o main.o

clean:

   -rm -f guessGame *.o

However it says there's 'no rule for target guess.cpp needed for guess.o.' Same goes for the header file. I know it's because the files 'guess.cpp' and 'guess.h' don't exist but it's because I'm supposed to split the .adt file to make it into guess.cpp and guess.h. How do I create a rule then for targets guess.cpp and guess.h using the adt file?

(Please bear with me as I'm new to this) I'm working on a makefile for a simple program and it has two files associated with it: main.cpp and game.adt. From game.adt I'm supposed to split it into 2 parts for the header and source code (guess.h and guess.cpp) using csplit. I've tried compiling the makefile like this:

HEADERS=guess.h

#Targets:

default: guessGame

guessGame: guess.o main.o
       
                g++ guess.o main.o -o guessGame

guess.o: guess.cpp $(HEADERS) 

                g++ -c guess.cpp -o guess.o

main.o: main.cpp $(HEADERS)

         g++ -c main.cpp -o main.o

clean:

       -rm -f guessGame *.o

However it says there's 'no rule for target guess.cpp needed for guess.o.' Same goes for the header file. I know it's because the files 'guess.cpp' and 'guess.h' don't exist but it's because I'm supposed to split the .adt file to make it into guess.cpp and guess.h. How do I create a rule then for targets guess.cpp and guess.h using the adt file?

Source Link

unix makefile error --no rule to make target

(Please bear with me as I'm new to this) I'm working on a makefile for a simple program and it has two files associated with it: main.cpp and game.adt. From game.adt I'm supposed to split it into 2 parts for the header and source code (guess.h and guess.cpp) using csplit. I've tried compiling the makefile like this:

HEADERS=guess.h

#Targets:

default: guessGame

guessGame: guess.o main.o

            g++ guess.o main.o -o guessGame

guess.o: guess.cpp $(HEADERS)

            g++ -c guess.cpp -o guess.o

main.o: main.cpp $(HEADERS)

     g++ -c main.cpp -o main.o

clean:

   -rm -f guessGame *.o

However it says there's 'no rule for target guess.cpp needed for guess.o.' Same goes for the header file. I know it's because the files 'guess.cpp' and 'guess.h' don't exist but it's because I'm supposed to split the .adt file to make it into guess.cpp and guess.h. How do I create a rule then for targets guess.cpp and guess.h using the adt file?