Getting Started - Trainraider/gtk3-glade-c-template GitHub Wiki

GTK+ 3.0 library headers and Make are required to build this project. Glade is needed to edit the user interface. GCC or Clang is probably required. This hasn't been tested with Windows and probably isn't portable there yet.

Debian or Ubuntu based linux distro:

$ sudo apt install libgtk-3-dev glade

The project can be configured in config.mk to set the project's version, name etc. These are then made available to the program as macros, so you never need these things listed in multiple places.

The following macros are available to the C source files:

VERSION   //The project's version number
TARGET    //Name without spaces/ executable name
NAME      //The project's name
AUTHOR    //Your name
APP_ID    //Your email/website and app name in reverse url format
          //  e.g. com.gmail.johndoe.myapp
APP_PREFIX//APP_ID with forward slashes instead of periods. Used for
          //  getting resources
          //  e.g. /com/gmail/johndoe/myapp
COPYRIGHT //A copyright message e.g. "Copyright (c) 2021"

When you edit the TARGET, there's one place where it isn't updated automatically: window_main.glade. You'll need to edit that file and replace template_app with your target name, otherwise your app may fail to load its icon when installed. In the Glade UI, this field can be found in the window_main's Icon Name field.


To build the project, simply run:

$ make

To build a debug version with lots of warnings and protections enabled:

$ make debug

To install the resulting application run (as root):

$ sudo make install

To uninstall (as root):

$ sudo make uninstall

You are encouraged to format your code (clang-format required) by running:

$ make format

You can clean up project files with:

$ make clean