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 6770599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:19:53+00:00 2026-05-26T15:19:53+00:00

I have a Makefile that only compiles/recompiles what’s necessary. However, even after something is

  • 0

I have a Makefile that only compiles/recompiles what’s necessary. However, even after something is compiled I would like to see their compile warnings.

My scenario is this:
1) I make a file called snake.cpp.
2) I make my project. snake.cpp has 3 warnings and 0 errors.
3) I make another file called cup.cpp
4) I make my project, now I see cup.cpp’s warnings but none of snake.cpp’s warnings.

But I want to see snake.cpp’s warnings, even though the compiling is skipped by make. I don’t want to recompile the whole project with -Werror. In fact, I don’t want to recompile anything unless I actually edited the relevant files, but I would still like to see the warnings.

What is the best way of achieving this?

  • 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-26T15:19:54+00:00Added an answer on May 26, 2026 at 3:19 pm

    The compiling isn’t skipped “by mistake”, it’s skipped because the executable/object is newer than the source. That’s how makefiles work. And the only way to get the warnings without recompiling is by storing them somewhere. It sounds like your solution is to redirect errors to a log file and print them back out when you make. Perhaps this will work, but I haven’t tested it:

    all: snake cup
        @cat snake.err
        @cat cup.err
    
    snake: snake.cpp
        g++ snake.cpp -o snake 2>snake.err
    
    cup: cup.cpp
        g++ cup.cpp -o cup 2>cup.err
    
    .PHONY: all
    

    If they’re both part of the same executable you’ll want to make objects instead.

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

Sidebar

Related Questions

I have a Makefile that looks like this CXX = g++ -O2 -Wall all:
In my Makefile.am file I have something like this: bin_PROGRAMS = foo bar foo_SOURCES
I would like to have a makefile like this: cudaLib : # Create shared
I have a very simple makefile, that basically does the following: # Pre-compiled header
I want to make a bash script that works like a makefile. It would
I have a working makefile that builds with mingw32. Now i renamed that makefile
I have a makefile project that builds and links a DLL, using the command-line
I have a section of makefile that has this sort of structure: bob: ifdef
I have a project that has a makefile with broken dependencies. Is there any
I have some demos that I downloaded and they come with a Makefile.win and

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.