Skip to content

Instantly share code, notes, and snippets.

@abekkine
Created January 7, 2017 05:10
Show Gist options
  • Save abekkine/ec1486327b9a4b75cae6b5bedb7f1c21 to your computer and use it in GitHub Desktop.
Save abekkine/ec1486327b9a4b75cae6b5bedb7f1c21 to your computer and use it in GitHub Desktop.
Embedding Version Info
#include <iostream>
#include "Version.h"
int main() {
std::cout << "Version : " << VERSION_STR << std::endl;
return 0;
}
all: version
g++ -o main main.cpp
version:
sh version.sh
clean:
rm *.o main Version.h
#!/bin/bash
FILE=Version.h
VSTR=v0.1
echo "#ifndef VERSION_H_" > $FILE
echo "#define VERSION_H_" >> $FILE
echo >> $FILE
echo "#define VERSION_STR \"$VSTR\"" >> $FILE
echo >> $FILE
echo "#endif // VERSION_H_" >> $FILE
echo >> $FILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment