Skip to content

Instantly share code, notes, and snippets.

View ragnarlodbrok1992's full-sized avatar
🫒
Watermeloning

Ragnar Lodbrok ragnarlodbrok1992

🫒
Watermeloning
  • Gdańsk, Pomerania, Poland
View GitHub Profile
@ragnarlodbrok1992
ragnarlodbrok1992 / placeholder.sh
Created April 18, 2025 18:18
Bash function to create linux c++ boilerplate to quickly run code.
cpp-placeholder() {
echo "Creating cpp boilerplate..."
echo "To run just do 'make'."
printf "# Compiler\nCXX = g++\n\n# Compiler flags\nCXXFLAGS = -Wall -Wextra -std=c++17\n\n# Output executable\nTARGET = main\n\n# Source file\nSRC = main.cpp\n\n# Default target\ndefault: all run clean\n\n# Build target\nall: \$(TARGET)\n\n# Compile the source file directly into executable\n\$(TARGET): \$(SRC)\n\t\$(CXX) \$(CXXFLAGS) -o \$(TARGET) \$(SRC)\n\n# Run the application\nrun: \$(TARGET)\n\t./\$(TARGET)\n\n# Clean the build files\nclean:\n\trm -f \$(TARGET)\n" > Makefile
printf "#include <stdio.h>\nint main(int argc, char** argv) {\n (void) argc;\n (void) argv;\n printf(\"Boilerplate file...\x5c\x6e\");\n return 0;\n}\n" > main.cpp
}