Makefile in action
สร้างไฟล์โปรแกรมจำนวน 3 ไฟล์ ได้แก่
hello.cpp
function.h
main.cpp
// hello.cpp
#include <iostream>
#include "function.h"
using namespace std;
void print_hello()
{
cout << "Hello World" << endl;
}// function.h
#ifndef FUNCTIONS_H
#define FUNCTIONS_H
void print_hello();
#endifหลังจากนั้นให้สร้างไฟล์ Makefile ดังนี้
หลังจากนั้นให้ทำการรันด้วยคำสั่งดังนี้
Last updated
Was this helpful?