[comp.sys.amiga] Opening a window

ins_adjb@jhunix.UUCP (Daniel Jay Barrett) (05/14/87)

	Can someone please help a beginning Intuition programmer?
I typed in the example window-opening program on pages 11-12 of the
INTUITION REFERENCE MANUAL, and compiled using Manx 3.20a.  The
compilation went fine, but the linker could not find _INTUITIONBASE
defined.

	My exact commands were:

		cc +L win.c
		ln win.o -lc

	I typed in the program exactly as it appears, proper capitalization
and all, except I added the lines:

	#include <functions.h>
	#include <intuition/intuitionbase.h>

after the compiler complained.  I am running under 1.2, 33.47.  Thanks.
---
Dan Barrett	ins_adjb@jhunix.UUCP
		barrett@hopkins-eecs-bravo.arpa

higgin@cbmvax.UUCP (05/16/87)

In article <4866@jhunix.UUCP> ins_adjb@jhunix.UUCP (Daniel Jay Barrett) writes:
$	Can someone please help a beginning Intuition programmer?
$I typed in the example window-opening program on pages 11-12 of the
$INTUITION REFERENCE MANUAL, and compiled using Manx 3.20a.  The
$compilation went fine, but the linker could not find _INTUITIONBASE
$defined.

Perhaps you typed 'struct INTUITIONBASE' instead of 'struct IntuitionBase'.

$	My exact commands were:
$		cc +L win.c
$		ln win.o -lc
                           ^
                           |
When using the +L option i the compiler, you should specify -lc32, and
not -lc.  The -l option of the compiler is simply an easier way of specifying
a library of object code to link to.  Anything after -l is presumed to be
the name of a library with a '.lib' suffix, in either the current
directory, or one specified by the CLIB environment variable.  c.lib
contains object modules compiles expecting 16 bit ints, and c32.lib contains
object modules compiled with the +l flag (i.e., expecting 32 bit ints).

	Paul.

flaps@utcsri.UUCP (05/24/87)

I'm posting this because it could be of general interest.

In article <4866@jhunix.UUCP> ins_adjb@jhunix.UUCP (Daniel Jay Barrett) writes:
>I typed in the example window-opening program on pages 11-12 of the
>INTUITION REFERENCE MANUAL, and compiled using Manx 3.20a.  The
>compilation went fine, but the linker could not find _INTUITIONBASE
>defined.

When you use OpenLibrary, the result gets stored in a variable which is
MYSTERIOUSLY used somehow presumably in conjunction with the window.  This
should definitely be explained more in the manuals!  What is actually
happening is that the routines that use it refer to it as an extern, and
use it as the base-address for the library.  So you must make it a global,
exported (not "static"ed) variable, and you must call it exactly the name
that it is supposed to be called.  If you don't, the linker won't match it
up with the externs in the library functions you call, and will give an
undefined reference error of some kind.

>	My exact commands were:
>
>		cc +L win.c
>		ln win.o -lc
                          ^^
As Paul Higginbottom noted, you should be linking with c32.lib not c.lib if
you are compiling +L.  This is on the second disk and should be copied onto
ram: or wherever your CLIB variable points.  But I would advise trying to
use the normal 16-bit library as soon as possible after you manage to get
your first program working.

You should try to declare all external functions returning types other than
int and void.  For one, this is more important when the number of bytes in
the type being returned is different than the number of bytes in an int,
which is true in the Manx compiler (and not in Lattice).

-- 

      //  Alan J Rosenthal
     //
 \\ //        flaps@csri.toronto.edu, {seismo!utai or utzoo}!utcsri!flaps,
  \//              flaps@toronto on csnet, flaps at utorgpu on bitnet.


Kermit - Protocol error