I was practicing building Linked List and thought of separating my functions into separate files and decouple everything from the main file.
This is the file structure I came up with
./
functions
printlist.cpp
functionbcd.cpp
functions.h
LinkedList.cpp
Node.h
Header File in LinkedList.cpp
#include "functions.h"
#include <bits/stdc++.h>
using namespace std;
Header Files in functions.h
#include <bits/stdc++.h>
#include "Node.h"
Header Files in "Any Function Implemented".cpp
#include <bits/stdc++.h>
#include "..\functions.h"
using namespace std;
Compile Command
g++ -ggdb -O2 -std=c++14 LinkedList.cpp functions\*.cpp
Now if I keep the structure mentioned above, my compile time it 4-5x more than the structure where I keep and define all the functions in one file along with main.
I am unable to understand this.
And if there is a better way to structure my files and improve the compile time, please do tell.
Thank You.