请问这个makefile怎么写mytime.h 文件#ifndef _MY_TIME_H_#define _MY_TIME_H_int get_now_year();#endifmytime.cpp文件#include "mytime.h"#include int get_now_year(){time_t t = time(NULL);struct tm *p = localtime( &t );return p->tm_year + 1900;}a
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/26 10:54:49
请问这个makefile怎么写mytime.h 文件#ifndef _MY_TIME_H_#define _MY_TIME_H_int get_now_year();#endifmytime.cpp文件#include "mytime.h"#include int get_now_year(){time_t t = time(NULL);struct tm *p = localtime( &t );return p->tm_year + 1900;}a
请问这个makefile怎么写
mytime.h 文件
#ifndef _MY_TIME_H_
#define _MY_TIME_H_
int get_now_year();
#endif
mytime.cpp文件
#include "mytime.h"
#include
int get_now_year()
{
time_t t = time(NULL);
struct tm *p = localtime( &t );
return p->tm_year + 1900;
}
a.cpp文件
#include
#include "mytime.h"
using namespace std;
int main()
{
cout
请问这个makefile怎么写mytime.h 文件#ifndef _MY_TIME_H_#define _MY_TIME_H_int get_now_year();#endifmytime.cpp文件#include "mytime.h"#include int get_now_year(){time_t t = time(NULL);struct tm *p = localtime( &t );return p->tm_year + 1900;}a
a:a.o mytime.o
g++ -o a a.o mytime.o
a.o:a.cpp mytime.h
g++ -c a.cpp
mytime.o:mytime.cpp mytime.h
g++ -c mytime.cpp