I have the following code on my main.cpp:
functions.h:Code:#ifdef _WIN64 #define hOS 1 #elif _WIN32 #define hOS 1 #elif __APPLE__ #define hOS 2 #elif __linux #define hOS 3 #else #define hOS 0 #endif #include "functions.h"
functions.cpp:Code:#ifndef _FunctionsFile #define _FunctionsFile #include <string.h> #include <iostream> using namespace std; void someFunction(bool someParameter); #endif
When trying to complile I get this error in functions.cpp:Code:#include "functions.h" void someFunction(bool someParameter= false) { if (hOS==1) { std::cout<<"Windows"; } }
C:\Dev\CPP\functions.cpp `hOS' undeclared (first use this function)




Reply With Quote