bugmake - Bugs: bug #29242, make fails to check timestamp of...

 
 

bug #29242: make fails to check timestamp of .h file and declares .o files are upto date

Submitted by:  None
Submitted on:  Wed 17 Mar 2010 07:13:09 AM UTC  
 
Severity: 3 - NormalItem Group: Bug
Status: Not A BugPrivacy: Public
Assigned to: NoneOpen/Closed: Closed
Component Version: 3.81Operating System: POSIX-Based
Fixed Release: NoneTriage Status: None

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Wed 17 Mar 2010 12:08:54 PM UTC, comment #1:

If you have no makefile to declare it, then make cannot know that test.cpp depends on test.h, so changing test.h won't cause test.cpp to recompile. If you want it to recompile, you have to create a makefile that declares test.h a prerequisite of test.cpp

Please see the GNU make manual for details.

Paul D. Smith <psmith>
Project Administrator
Wed 17 Mar 2010 07:13:09 AM UTC, original submission:

Follow the [STEP 1] to [STEP 5] to get the output.

[STEP 1]:Create and edit test.h file as shown below.

[root@CentOS_Vmware example]#vi test.h

#include<iostream>

using namespace std;

void PRINT()
{
cout<<"This is a test\n";

}
~
~
~

[STEP 2]: Create and edit test.cpp file as shown below.

[root@CentOS_Vmware example]# vi test.cpp

#include "test.h"

int main(){

PRINT();

return 0;

}

~
~
[STEP 3]: run make command as below (without creating any Makefile)

[root@CentOS_Vmware example]# make test.o
g++ -c -o test.o test.cpp
[root@CentOS_Vmware example]#

[STEP 4]:Edit test.h file and change the output text as below.

[root@CentOS_Vmware example]# vi test.h

#include<iostream>

using namespace std;

void PRINT()
{
cout<<"test complete\n";

}
~
~
~
[STEP 5]: run make command again

[root@CentOS_Vmware example]# make test.o
make: `test.o' is up to date.

Expected:
I was expecting the make tool to check the timestamp of both .h and .cpp and recompile .cpp to create .o files.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by psmith (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 17 Mar 2010 12:08:54 PM UTCpsmithStatusNone=>Not A Bug
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1