Re: Arrows in UniIdraw

"Scott Johnston" <[email protected]> Mon, 15 Jul 2002 10:34:18 -0700
Newsgroups gmane.comp.lib.ivtools.devel
Message-ID <[email protected]>
David Nowak wrote:

>Hello,
>
>I started to develop my own graphic editor with Unidraw. My small program
>compiled and ran well. But I needed arrows. Unfortunately Unidraw cannot deal
>with arrow, can it? Thus I used UniIdraw in order to have arrows: I added a few
>#include:
>
>  #include <UniIdraw/idarrows.h>
>  #include <UniIdraw/idarrow.h>
>
>and the lines
>
>  ArrowLine *
>    line = new ArrowLine (0, 0, unit, unit, false, false, 1., stdgraphic);
>  ArrowLineComp *
>    arrowLineComp = new ArrowLineComp (line);
>  Include (new
>	   GraphicCompTool (new
>			    ControlInfo (arrowLineComp, KLBL_LINE, CODE_LINE),
>			    arrowLineComp), tools);
>
>in my source code.
>
>Now, it compiles well but it terminates on a segmentation fault when it calls
>the constructor for GraphicCompTool!
>
>I compile, with Gun C++ 2.95.2 in Linux RedHat 6.2, this way:
>
>c++ -Div2_6_compatible -g -c -I $PREFIX/include/IV-2_6 \
>    -I $PREFIX/include diaged.c
> 
>c++ -Div2_6_compatible -g -c -I $PREFIX/include/IV-2_6 \
>    -I $PREFIX/include main.c 
>c++ -Div2_6_compatible -g -o diagram -L $PREFIX/lib -lUniIdraw \
>    -lUnidraw -lIV -L /usr/X11R6/lib -lXext diaged.o main.o
>
>Can anyone help me?
>
>Manny thanks,
>
>David.
>  
>
David,

Maybe gdb can help you.  Run it via emacs (M-x gdb) and it will show you 
exactly
where the segmentation fault occurs, and you can probe the value of any
variable to see what is wrong.

Or maybe you have object code that is out of synch with the source code. 
 If you
are running it in gdb, and the segfault occurs right when you step into 
the constructor
and there is no other evidence of anything going wrong, this is probably 
the problem.

Deleting all the .o's and rebuilding them is one way of dealing with 
this.  In the ivtools source
tree you can do a "make depend" to refresh the dependencies (stored in 
Makefile.depend)
and a subsequent "make" will rebuild all object code where a change has 
occurred
either directly to the module or indirectly in a .h file.

Jut out of curiousity, what kind of drawing editor are you building?

Scott Johnston
http://www.ivtools.org




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf