Last active
April 18, 2016 01:15
-
-
Save xaxxon/98a8e8e83d4298bb21782fc72e2aafef to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mylib.h | |
#ifndef MYLIB_H | |
#define MYLIB_H | |
std::string get_operating_system_name(); | |
#endif // MYLIB_H | |
mylib.cpp | |
#include "mylib.h" | |
#ifdef __APPLE__ | |
#include "os_x_mylib.cpp" | |
#elif defined __linux__ | |
#include "linux_mylib.cpp" | |
#endif | |
.. any other platform independent code .. | |
os_x_mylib.cpp | |
std::string get_operating_system_name() { | |
return "os x"; | |
} | |
linux_mylib.cpp | |
std::string get_operating_system_name() { | |
return "linux"; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment