I'm essentially trying to pass an initiated instance of a class to another class's method, and when I try to #include
the file with the class (so that I can declare my parameter's type to be that class) I end up with a redefinition error (see below)
/Users/arya/Desktop/Arya/Coding/macOS/xx:xxxx/xx:xxxx/Source/Utility/Process/Main.cpp:4:7: Redefinition of 'Process'
/Users/arya/Desktop/Arya/Coding/macOS/xx:xxxx/xx:xxxx/Main.cpp:1:10: In file included from /Users/arya/Desktop/Arya/Coding/macOS/xx:xxxx/xx:xxxx/ Main.cpp:1:
/Users/arya/Desktop/Arya/Coding/macOS/xx:xxxx/xx:xxxx/Header.hpp:9:10: In file included from /Users/arya/Desktop/Arya/Coding/macOS/xx:xxxx/ xx:xxxx/./Header.hpp:9:
/Users/arya/Desktop/Arya/Coding/macOS/xx:xxxx/xx:xxxx/Source/Utility/Scanner/Main.cpp:1:10: In file included from
/Users/arya/Desktop/Arya/Coding/macOS/xx:xxxx/xx:xxxx/./Source/Utility/Scanner/Main.cpp:1:
/Users/arya/Desktop/Arya/Coding/macOS/xx:xxxx/xx:xxxx/Source/Utility/Scanner/Header.hpp:10:10: In file included from /Users/arya/Desktop/Arya/ Coding/macOS/xx:xxxx/xx:xxxx/./Source/Utility/Scanner/./Header.hpp:10:
/Users/arya/Desktop/Arya/Coding/macOS/xx:xxxx/xx:xxxx/Header.hpp:8:10:'/Users/arya/Desktop/Arya/Coding/macOS/xx:xxxx/xx:xxxx/./Source/Utility/ Scanner/../Process/Main.cpp' included multiple times, additional include site here
/Users/arya/Desktop/Arya/Coding/macOS/xx:xxxx/xx:xxxx/Source/Utility/Scanner/Header.hpp:10:10:'/Users/arya/Desktop/Arya/Coding/macOS/xx:xxxx/ xx:xxxx/./Source/Utility/Scanner
/../Process/Main.cpp' included multiple times, additional include site here
/Users/arya/Desktop/Arya/Coding/macOS/xx:xxxx/xx:xxxx/Source/Utility/Process/Main.cpp:4:7: Unguarded header; consider using #ifdef guards or #pragma once
FirstFile.cpp:
#include "./FirstFile.h"
class SomeClass {
SomeClass() {
// Do Stuff
}
}
FirstFile.h:
#ifndef FIRSTFILE_HEADER_HPP
#define FIRSTFILE_HEADER_HPP
#import <iostream>
// import stuff
#endif /* FIRSTFILE_HEADER_HPP */
SecondFile.cpp:
#include "./SecondFile.h"
class SomeClassTwo {
SomeClassTwo(Someclass * InitializedClass) {
InitializedClass -> DoSomething()
}
}
SecondFile.h:
#ifndef SECONDFILE_HEADER_HPP
#define SECONDFILE_HEADER_HPP
#import "./FirstFile.cpp"
// import stuff
#endif /* SECONDFILE_HEADER_HPP */
I've tried using header guards but still no luck ;(
I would appreciate any help and let me know if I need to add any more information to this