Skip to content

Instantly share code, notes, and snippets.

@5a494d
Created July 24, 2018 18:50
Show Gist options
  • Save 5a494d/e5f3873f8501eeb98eaf0e3a72d94c98 to your computer and use it in GitHub Desktop.
Save 5a494d/e5f3873f8501eeb98eaf0e3a72d94c98 to your computer and use it in GitHub Desktop.
Compile and execute gtkmm file
#!/bin/bash
echo "# File name: $1"
CPPFILE=$1
# Remember to put file path to environment system
# .profile .bash_profile .bash_login
# if [ -d "$HOME/.bash" ] ; then
# PATH="$PATH:$HOME/.bash"
# fi
if [ -f "./$CPPFILE" ]; then
file=$(basename -- "$CPPFILE")
CPPEXT="${CPPFILE##*.}"
CPPNAME="${CPPFILE%.*}"
echo "# Compiling"
COMFILE="$CPPNAME.o"
g++ -c ./$CPPFILE -o ./$COMFILE $CPPNAME `pkg-config gtkmm-3.0 --cflags --libs`
if [ -f "./$CPPNAME" ]; then
echo "# Executing file"
chmod +x ./$CPPNAME
echo "######################### BEGIN OUTPUT ##########################"
./$CPPNAME
echo "######################### END OUTPUT ############################"
else
echo "################## HOUSTON WE HAVE A PROBLEM ####################"
fi
else
echo "# File not found!"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment