Skip to content

Instantly share code, notes, and snippets.

@donwilson
Created December 5, 2015 21:27
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 donwilson/92805c3d42a2023fd4a8 to your computer and use it in GitHub Desktop.
Save donwilson/92805c3d42a2023fd4a8 to your computer and use it in GitHub Desktop.
#!/bin/bash
SOURCE_FILE=$1
if [[ -z "$SOURCE_FILE" ]]; then
SOURCE_FILE="main"
fi
if [[ ! -f "$SOURCE_FILE.cpp" ]]; then
echo "!! $SOURCE_FILE.cpp not found, exiting..."
exit
fi
echo "Compiling $1.cpp..."
g++ -c $SOURCE_FILE.cpp -I/root/sfml/include
g++ $SOURCE_FILE.o -o $SOURCE_FILE -L/root/sfml/lib -lsfml-graphics -lsfml-window -lsfml-system
export LD_LIBRARY_PATH=/root/sfml/lib && ./$SOURCE_FILE
rm $SOURCE_FILE.o
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment