Skip to content

Instantly share code, notes, and snippets.

@xaxxon
Last active April 18, 2016 01:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xaxxon/98a8e8e83d4298bb21782fc72e2aafef to your computer and use it in GitHub Desktop.
Save xaxxon/98a8e8e83d4298bb21782fc72e2aafef to your computer and use it in GitHub Desktop.
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