Imagine I have two files .hpp:
#ifndef _DEF_FILE_1_
#define _DEF_FILE_1_
inline void some_function_1(){
}
#endif
and
#ifndef _DEF_FILE_2_
#define _DEF_FILE_2_
#ifdef _DEF_FILE_1_
inline void some_function_2(){
}
#else
inline void some_function_2(){
}
#endif
#endif
My problem arises when I do not know in what order the files are included, for example: in main.cppI may have something like:
#include "file1.hpp"
#include "file2.hpp"
int main(){
some_function_2();
}
or
#include "file2.hpp"
#include "file1.hpp"
int main(){
some_function_2();
}
Is there a way to make sure that as soon as file1.hpp, and file2.hpp
included, then the some_function_2()cause some_function_1()?
PS: One solution is to include file1.hppin file2.hpp, but I can’t do that, because I am developing code that may or may not depend on some library that the end user may or may not have.
PPS: , ( ,
) "" some_method_2(),
file1.hpp , file2.hpp.