Build a tiny Objective-C desktop app on Debian in about 15 minutes after installing the tools. You will change its interface in Gorm, count button clicks, and stop inside the button action with GDB.
- A Debian graphical desktop with GNUstep Base, GUI, a working GUI backend, GNUstep make, and an Objective-C compiler/development headers installed.
- Ycode built from this repository and available to launch, including its GDB debugger bundle. Follow the Ycode installation guide.
- Gorm (GNUstep's interface editor) and GDB installed.
gdb --versionandgnustep-config --objc-flagsshould work in a terminal. - A writable checkout of this repository. The sample is Examples/FirstApp; no extra libraries or project conversion are needed.
If your terminal does not already have the GNUstep environment, use a Bash terminal and run:
. "$(gnustep-config --variable=GNUSTEP_MAKEFILES)/GNUstep.sh"Launch Ycode from that same terminal with openapp Ycode. Gorm can be launched
with openapp Gorm. GNUstep's menus may appear in a separate menu window;
menu names below are for GNUstep, not macOS.
In Ycode choose File > Open Project... and select
Examples/FirstApp/GNUmakefile in your checkout. The navigator should show
AppController.h, AppController.m, main.m, and MainMenu.gorm.
Leave Target at Automatic and Architecture at Native.
This is Ycode's existing GNUmakefile folder format. main.m starts the app;
MainMenu.gorm contains its window, label, button, and connections to
AppController. The hidden .ycode.plist supplies the executable path for
Run and Debug. The makefile enables debug symbols and disables optimization.
You do not need to create another project or settings file.
- Double-click MainMenu.gorm in Ycode's navigator. It should open in Gorm.
If the file association is missing, launch Gorm, choose Document > Open...,
and select that same
MainMenu.gormpackage in the sample's source folder. - In Gorm's document window, select Objects. If the app window is not already visible, double-click its Window(0) icon. You should see Ready to count! and a Count a click button.
- Double-click the label to edit it. Select all of its text (a triple-click selects the line), and type Hello from Gorm!. Click the button once in the designer to finish editing the label; this selects the button rather than running its action.
- Choose Document > Save. If Save is disabled after inline editing, use Document > Save As..., keep File Type: GNUstep Gorm, save as MainMenu.gorm in the same source folder, and choose Replace. This fallback was needed on the Gorm build used to verify this guide.
Edit the source MainMenu.gorm, not the copy inside FirstApp.app/Resources.
Keep the existing controller connections. No source-code change is needed for
this label edit. The sample uses Gorm's native format because the verification
machine could read the template's XIB but failed to save it with
GormNSWindow-scriptingProperties not implemented / Could not write file
wrapper. Keeping GNUstep Gorm avoids that XIB writer problem.
Return to Ycode and choose Project > Build. The Console pane should
finish with Build succeeded. The build creates FirstApp.app in the
sample folder.
Choose Project > Run. A window titled First App in Ycode should appear with Hello from Gorm! and Count a click. Click the button: the label becomes Button clicks: 1. Click again: it becomes Button clicks: 2. The initial greeting is intentionally replaced on the first click.
Choose Project > Stop in Ycode before debugging. Alternatively, close the sample's window or use its Application > Quit menu. Each launch starts the counter at zero.
If the greeting is still Ready to count!, return to Gorm and use the Save As... fallback above. Then stop the running app and choose Project > Clean, Project > Build, and Project > Run. A running app cannot reload its interface just because the source file changed.
- Single-click AppController.m in Ycode. Find
incrementCounter:and the comment beginning BREAKPOINT. The action increments the instance variablecounter, then copies it into the local integercountso it is easy to inspect in the Variables pane. - Choose Project > Debug. Wait for Debugger ready. This builds the app and starts GDB, but does not run the app yet.
- Place the text cursor on the
[statusLabelstatement immediately below the BREAKPOINT comment. Choose Project > Debugger > Toggle Breakpoint at Selection. A red dot appears beside that executable line. You can also click its gutter to toggle the same breakpoint. Do not break on the comment. - Choose Project > Debugger > Go. The sample window appears. Click Count a click (activate the window first if necessary).
- Return to Ycode. The Debugger tab should show Stopped: breakpoint-hit and a yellow arrow at the label-update statement. In Variables, expand Locals if necessary: count should have value 1, type int. If the variables pane is hidden, use the variables icon at the right of the debugger toolbar. The app is paused before it updates the label.
- Choose Project > Debugger > Continue. The label becomes Button clicks: 1. Click again to stop with count = 2. Choose Project > Stop to finish the debugging session.
The Debugger tab's bottom command field also accepts print count: press
Return while stopped to see the value in the transcript. This is a real GDB
session; Project > Run alone does not activate breakpoints. On the GNUstep
runtime used for verification, print self->counter produced an incorrect
value even though the app counted correctly. Inspect the local count instead:
it is copied directly from counter immediately before the breakpoint and
avoids GDB's instance-variable layout issue on that runtime.
If Debug waits without showing a window, choose Debugger > Go. If GDB
cannot be found, check gdb --version in the terminal used to launch Ycode.
For a standard /usr/bin/gdb installation, quit Ycode, run
defaults write Ycode DebuggerPath /usr/bin/gdb, and reopen it. If the
breakpoint stays unresolved or values are unavailable, stop, Project > Clean,
then Project > Debug again. Keep debug = yes in the supplied GNUmakefile
and open the source from the same sample folder that you are building.
See the debugger guide for more.
From the repository root you can also build the unmodified sample with:
make -C Examples/FirstApp
openapp Examples/FirstApp/FirstApp.appThe sample is standalone; the repository's aggregate build does not build it. It uses Objective-C 1.0 syntax and manual reference counting, following Ycode's AppKit application template. The interface owns the connected UI objects; the controller does not allocate or retain them separately.
Live verification on Debian 13 used a clean git archive HEAD source export
with these new sample files added, no sample build products, and an installed
Ycode/Gorm/GDB in a separate Xvfb graphical display. Gorm edited and saved the
label; Ycode built and ran the app; the changed greeting appeared; a button
click displayed Button clicks: 1. Ycode then launched real GDB, a source
gutter breakpoint stopped in incrementCounter:, and its Variables pane
showed count = 1 (int). These were live GUI/debugger operations, not a
simulated debugger test. The launch used the GNUmakefile as a command-line
argument and toolbar equivalents of Build/Run/Debug/Go; the documented menu
names were checked against Ycode's implementation. The initial XIB save and
inline-edit Save issues described above were encountered during this run.
The standalone sample build and make check-style passed. make check-objc1
audited the sample without failures but failed on four existing translation
units because UIKit and XCTest headers were unavailable. No IDE changes were
needed for this walkthrough.