Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6581671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:10:59+00:00 2026-05-25T16:10:59+00:00

What can I do to fix this problem? I’m new to emacs, Unix, and

  • 0

What can I do to fix this problem? I’m new to emacs, Unix, and makefiles. Please explain what I’m doing wrong and how I can fix it. I’m sure it’s a simple problem

progA: yesno.h yesno.cpp
       g++ -DDEBUG -c yesno.cpp yesno.h
progB: guess.cpp
       g++ -DDEBUG -c guess.cpp
progC: yesno.o guess.o
       g++ -DDEBUG -o guess guess.o yesno.o

My error is:

Your makefile does too much work when only guess.cpp has been changed:
g++ -c yesno.cpp yesno.h
g++ -c guess.cpp
g++ -o guess guess.o yesno.o
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T16:11:00+00:00Added an answer on May 25, 2026 at 4:11 pm

    Your makefile would recompile everything each time.

    You don’t need the first four lines; make knows how to create object files from source. Or, alternatively, you need to revise those 4 lines into 2, and put them at the end, and change the target names:

    guess: yesno.o guess.o
            g++ -o guess yesno.o guess.o
    guess.o: yesno.h
    yesno.o: yesno.h
    

    The first target is the one that is built by default, so that ensures that guess (the program) is built. The command line omits the -DDEBUG since that only affects source code compilation and there is no source in that link line (though, if using macros as one would in an advanced makefile, I’d be fine with the options such as -DDEBUG appearing in the link line).

    The third line says that guess.o depends on yesno.h; this is a guess (on my part). The make program already knows how to convert guess.cpp to guess.o; it just needs the extra information that it also uses the yesno.h header. (If it doesn’t, how does it know about the functions defined in yesno.cpp?)

    The last line says that yesno.o depends on yesno.h; again, make knows how to compile yesno.cpp to yesno.o but needs the extra information about the header.

    This should only recompile guess.o when only guess.cpp changes; it should only recompile yesno.o when yesno.cpp changes; it should recompile both object files when yesno.h changes. If any of the source files changes, the program will be relinked; if no source files change, then the make command should do nothing (or simply report that there is nothing to do).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone explain to me how I can fix this problem. I have two
I can't seem to find a way to fix this problem. All I'm doing
I can't fix this problem on my listview template: i have the error as
Can anyone explain the output of this program and how I can fix it?
I can fix this problem by messing with outher parts of my codebase but
My app run with wi-fi but not cellular network. How can fix this problem?
How can I fix this? REGEX: //REGEX $match_expression = '/Rt..tt<\/td> <td>(.*)<\/td>/'; preg_match($match_expression,$text,$matches1); $final =
How can I fix this error, and install thin or other gems? $ sudo
The Term::Size-module jumbles up the encoding. How can I fix this? #!/usr/bin/env perl use
My navbar doesn't line up in IE... how can I fix this without using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.