এই টিউটোরিয়ালে, আমরা সি++-এ মেকফাইল এবং এর অ্যাপ্লিকেশন সম্পর্কে আলোচনা করব।
এখানে পুরো প্রোগ্রামকে মেকফাইল দিয়ে ব্রেক করা হয়। এটি সাধারণত .cpp ফাইল এবং .h ফাইল বানাতে হয় সব ক্লাস/ফাংশনালিটির সাথে এবং সেগুলো লিংক করা হয়।
উদাহরণ
main.cpp
#include <bits/stdc++.h> #include "function.h" using namespace std; // মেইন এক্সিকিউশন প্রোগ্রাম int main(){ int num1 = 1; int num2 = 2; cout << multiply(num1, num2) << endl; int num3 = 5; cout << factorial(num3) << endl; print(); }print.cpp
#include <bits/stdc++.h> #include "function.h" using namespace std; void print() { cout < "makefile" << endl; }factorial.cpp
#include <bits/stdc++.h> #include "function.h" using namespace std; // ফ্যাক্টোরিয়াল প্রোগ্রাম int factorial(int n){ if (n == 1) return 1; return n * factorial(n - 1); }multiply.cpp
#include <bits/stdc++.h> #include "function.h" using namespace std; int multiply(int a, int b){ return a * b; }functions.h
#ifndef FUNCTIONS_H #define FUNCTIONS_H void print(); int factorial(int); int multiply(int, int); #endif
আউটপুট
2 120 makefile