Anjuta Notes

Fall 2019


Table of Contents


1. Install and Change Default Configuration

Install:
$ sudo apt install anjuta libtool-bin
To set the default configuration to "Default" instead of "Debug", make compiling and linking more verbose, and set standard compiler flags with all warnings enabled:

Download anjuta-config.sh

Then run it as root:

$ cd ~/Downloads
$ sudo sh anjuta-config.sh
anjuta-config.sh:
#! /bin/sh
#
# change Anjuta C/C++ default configuration
#
D="/usr/share/anjuta/templates/minimal"

echo "Working in $D/"

cd "$D" || exit 0

# backup the original if not done already
if [ ! -r anjuta.session.ORIG ]; then
  echo "Making backup copy of anjuta.session"
  cp -p anjuta.session anjuta.session.ORIG
fi

echo "Editing anjuta.session"
sed -e "s;BuildArgs/Default=.*;BuildArgs/Default=--disable-silent-rules \
'CFLAGS=-g -std=c11 -pedantic -Wall' 'CXXFLAGS=-g -std=c++17 -pedantic -Wall';" \
 -e "s/Selected Configuration=.*/Selected Configuration=Default/" anjuta.session.ORIG > anjuta.session

echo "Done."

2. Create a New Generic C Project


3. File -> New -> Project


4. Project Options


5. File -> Open ...

Find existing project not listed elsewhere - select the project .anjuta file


6. Build -> Configure Project ...


7. Configure Options


8. Compile Project

make at the top level:

make in the src/ subdirectory - use this one:

Run:


9. Edit


10. File -> New -> File ...


11. New C Source or Header File


12. Crash


13. Run the Debugger: gdb

% pwd
/home/perry/osp/crash
% gdb -q src/crash
Reading symbols from src/crash...done.
(gdb) run
Starting program: /home/perry/osp/crash/src/crash
hello

Program received signal SIGSEGV, Segmentation fault.
0x000055555555464f in main () at main.c:6
6	  *(int *)1000 = 1; // should crash here
(gdb) where
#0  0x000055555555464f in main () at main.c:6
(gdb) quit
A debugging session is active.

	Inferior 1 [process 7189] will be killed.

Quit anyway? (y or n) y
%