From: c188-cd@volga.Berkeley.EDU (Scott Davies)
Newsgroups: comp.windows.interviews
Subject: Problem with compilation
Date: 13 Apr 92 02:07:16 GMT
Article-I.D.: pasteur.1992Apr13.020716.3635
Distribution: ca
Organization: University of California, at Berkeley

I was trying to compile an example InterViews program given in the X journal
(Nov/Dec 1991); here were the files I had:


******************Imakefile**********************
XCOMM
XCOMM ifb - simple font browser
XCOMM

#ifdef InObjectCodeDir

Use_libInterViews()
Use_2_6()
ComplexProgramTarget(hello)

MakeObjectFromSrc(main)
MakeObjectFromSrc(circledraw)

#else

MakeInObjectCodeDir()

#endif
*************************************************

******************circledraw.h*******************
#include <InterViews/scene.h>

class CircleDraw:public MonoScene {
public:
    CircleDraw();
    void Handle(class Event&);
private:
    void Init();
    Interactor* Interior();
private:
    class GraphicBlock* grblock;
    class Picture* pict;
};
*************************************************

******************circledraw.c*******************
#include "circledraw.h"
#include <InterViews/event.h>
#include <InterViews/sensor.h>
#include <InterViews/message.h>
#include <InterViews/frame.h>

#include <InterViews/box.h>
#include <InterViews/glue.h>
#include <InterViews/Graphic/grblock.h>
#include <InterViews/Graphic/picture.h>
#include <InterViews/Graphic/ellipses.h>

#include <libc.h>

CircleDraw::CircleDraw() {
    Init();
    Insert(Interior());
}

void CircleDraw::Init() {
    Sensor* sensor = new Sensor;
    sensor->Catch(DownEvent);
    sensor->Catch(KeyEvent);
    Listen(sensor);

    InitPPaint();
    Circle* circ = new Circle(0,0,(Coord)inch);
    circ->SetBrush(psingle); circ->SetColors(pblack, pwhite);
    pict->Append(circ);
    grblock = new GraphicBlock(nil, pict);
}

Interactor* CircleDraw::Interior() {
    return new Frame(
        new VBox(
	    new HBox(new HGlue(), new Message("Drawing Circles"), new HGlue()),
	    new VGlue((Coord)(.5*cm)),
            grblock));
}

void CircleDraw::Handle(Event& e) {
    switch(e.eventType) {
    case KeyEvent:
	if (e.keystring[0] == 'q')
	    QuitRunning(e);
	break;
    case DownEvent:
	Circle* circ;
	Coord x, y, r;

	x = random()%(int)(2*inch)-inch;
	y = random()%(int)(2*inch)-inch;
	r = random()%(int)inch+1;

	circ = new Circle(x, y, r);
	circ->SetBrush(psingle); circ->SetColors(pblack, pwhite);
	pict->Append(circ);
	grblock->Update();
    }
}
*************************************************

******************main.c*************************
#include <InterViews/world.h>
#include "circledraw.h"

main(int argc, char** argv) {
    World* world = new World ("Hello", argc, argv);
    world->InsertApplication(new CircleDraw());
    world->Run();
}
*************************************************

I had performed the setenv's mentioned in the README file
(modified for my system's directory configuration):

setenv CPU SUN4
setenv MANPATH $MANPATH\:/disks/disk1/InterViews/iv/installed/man
setenv PATH $PATH\:/disks/disk1/InterViews/iv/installed/bin/$CPU

When I tried compiling the program with
ivmkmf
make Makefiles
make depend
make all

everything worked O.K. until the final stage:

*********************Compilation attempt**************
telemachus% make all
making all for SUN4 in ./SUN4
/disks/disk1/export/exec/sun4/CC/sun4/CC    -Dcplusplus_2_0 -Div2_6_compatible   -I/disks/disk1/InterViews/iv/installed/include/InterViews/2.6 -I/disks/disk1/InterViews/iv/installed/include/IV-look/2.6 -I/disks/disk1/InterViews/iv/installed/include -I/disks/disk1/export/exec/sun4/openwin/share/include  -D_NO_PROTO -DSTRINGS_ALIGNED -DNO_REGEX -DNO_ISDIR -DUSE_RE_COMP -DUSE_GETWD  -c ../circledraw.c
CC  ../circledraw.c:
"../circledraw.c", line 51: warning:  double  assigned to  int 
"../circledraw.c", line 52: warning:  double  assigned to  int 
"../circledraw.c", line 53: warning:  long  assigned to  int 
cc   -c -I/disks/disk1/export/exec/sun4/CC/sun4c/incl -I/disks/disk1/InterViews/iv/installed/include/InterViews/2.6 -I/disks/disk1/InterViews/iv/installed/include/IV-look/2.6 -I/disks/disk1/InterViews/iv/installed/include -I/disks/disk1/export/exec/sun4/openwin/share/include  circledraw.c
/disks/disk1/export/exec/sun4/CC/sun4/CC    -o a.out *.o  -L/disks/disk1/InterViews/iv/installed/lib/SUN4   -lIV -L/disks/disk1/export/exec/sun4/openwin/lib -lXext -lX11 -lm  
cc   -o /disks/disk1/scott/InterViewsTest2/SUN4/a.out -I/disks/disk1/export/exec/sun4/CC/sun4c/incl  circledraw.o main.o -L/disks/disk1/InterViews/iv/installed/lib/SUN4 -L/disks/disk1/export/exec/sun4/openwin/lib  -lIV -lXext -lX11 -lm -L/disks/disk1/export/exec/sun4/CC/sun4c/ -lC
ld: /disks/disk1/export/exec/sun4/CC/sun4c//libC.sa.0.1: warning: table of contents for archive is out of date; rerun ranlib(1)
ld: Undefined symbol 
   ___vtbl__12MultiLineObj 
   ___ct__12GraphicBlockFP8ivSensorP7GraphiciUi7Zooming 
   ___vtbl__7LineObj 
   ___ct__6CircleFiN21P7Graphic 
   ___vtbl__6Circle 
   _pwhite 
   _psingle 
   _InitPPaint()   
   ___vtbl__11FullGraphic 
   _pblack 
   ___vtbl__10FillCircle 
   ___vtbl__11FillEllipse 
   Picture::_Append(Graphic*,Graphic*,Graphic*,Graphic*) 
   ___vtbl__6BoxObj 
   ___vtbl__8PointObj 
*** Error code 2
make: Fatal error: Command failed for target `a.out'
Current working directory /disks/disk1/scott/InterViewsTest2/SUN4
telemachus% 
******************************************************

Can anyone fingure out what's going on here?  Are the functions and classes
used in this example just made up, or is there a library that I'm not
linking up to for some reason?  If there's a another library I need to link
to, how can I modify the Imakefile (or whatever) so that it's included?

Notes of possible interest:

-The "table of contents for archive is out of date" message happens on our
 system all the time, and most probably has nothing to with the difficulties
 I'm having.
-I did manage to get a simpler example (a window that pops up with "Hello"
 written on it) to work using an Imakefile almost identical to the one above.
 (The only difference was that there was no line that read

 MakeObjectFromSrc(circledraw)

 for obvious reasons.)  As far as I can tell, the same library files were
 included in the calls to the linker for the two different examples.
-It doesn't seem to matter what I use as an argument for ComplexProgramTarget;
 I always wind up with a.out as the executable's name.  (This is what happens
 when I get the simpler example to work.)  While this is a minor problem that
 can easily be worked around, I'd still like to know why this doesn't seem to
 be working.


Any assistance you might have to offer would be greatly appreciated!
(Please reply by e-mail if possible.)

Scott Davies

c188-cd@volga.berkeley.edu
Newsgroups: comp.windows.interviews