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