CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2017
    Posts
    17

    Question 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.

  2. #2
    Join Date
    Jan 2017
    Posts
    17

    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
  •  





Click Here to Expand Forum to Full Width

Featured