Anjuta Notes

ECE 2620, 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. New Class


10. Generate Class .h and .cc Files and Add to Project


11. Edit Class .h and .cc Files


12. Crash


13. Run the Debugger: gdb

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

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

        Inferior 1 [process 16595] will be killed.

Quit anyway? (y or n) y
%