-
January 28th, 2017, 07:12 PM
#1
How to use a makefile
I've written a makefile and saved it under the name "MakeFile" (provided below) for my program. It's in the same folder as my programs.
all: main
main.o: main.cc Greetings.cc
g++ -c -Werror main.cc
Greetings.o: Greetings.cc Greetings.h
g++ -c -Werror Greetings.cc
main: main.o Greetings.o
g++ -0 main main.o Greetings.o
Now how do I actually use the makefile? I read that you should type in make [options] [target1 target2 ...]. What are options and target? As an experiment, I tried typing "make MakeFile" and I got an error as shown below.
Conrados-MBP:~ conrados$ make MakeFile
make: *** No rule to make target `MakeFile'. Stop.
Last edited by asilvester635; January 28th, 2017 at 07:14 PM.
-
January 28th, 2017, 11:40 PM
#2
Re: How to use a makefile
I'm using a Macbook pro and sublime text 3 for my text editor. I'm also using my computer's terminal to compile my code.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|