[comp.unix.ultrix] Problems compiling a 3 line Motif program!!!

dcb@dave.mis.semi.harris.com (Dave Brillhart) (06/03/91)

I've finally found time to start programming in the wonderful
world of Motif.  A friend recommended the Marshall Brain
Tutorials (a great tip).  I can't seem to get the first "Hello World"
program to compile... I'm sure it's some kind of setup problem.
(BTW, I can compile most other x programs except mxrn. The
only commonality I could find was mxrn also uses <Xm.h>.)

I'm running Ultrix 4.1 on a DECstation 5000. I loaded OSF/Motif
1.1. That MAY be the problem right there - I've read 4.1 is based
on R3 intrinisics while Motiif 1.1 is R4???  Any conformation on
that? What follows is the program and error message (same thing
happens with or without the commented lines):

Thanks in advance for and comments,
   Dave Brillhart
   Harris Semiconductor
   Melbourne, FL
=======================================================
#include <X11/Intrinsic.h>
#include <Xm/Xm.h>
#include <Xm/Label.h>

main(int argc, char *argv[])
{
  Widget toplevel;  Arg al[10];  int ac=0;

  toplevel = XtInitialize(argv[0],"",NULL,0,&argc,argv);
/*
 
XtSetArg(al[ac++],XmNlabelString,XmStringCreate("hello",XmSTRING_DEFAULT
T_CHARSET));
  msg = XtCreateManagedWidget("msg",xmLabelWidgetClass,toplevel,al,ac);
*/
  XtRealizeWidget(toplevel);
  XtMainLoop();
}
===========================================================
ccom: Error: /usr/lib/DXM/lib/Xm/Xm.h, line 2017: syntax error
      typedef XtPointer (*XmResourceBaseProc)();
      -------------------^
ccom: Error: /usr/lib/DXM/lib/Xm/Xm.h, line 2017: function returns
illegal type
      typedef XtPointer (*XmResourceBaseProc)();
      -----------------------------------------^
ccom: Error: /usr/lib/DXM/lib/Xm/Xm.h, line 2020: syntax error
          XmResourceBaseProc  base_proc;
      ---------------------^
(ccom): /usr/lib/DXM/lib/Xm/Xm.h, line 2020: cannot recover from earlier
errors: goodbye!
          XmResourceBaseProc  base_proc;
      ----------------------------------^

klee@wsl.dec.com (Ken Lee) (06/03/91)

In article <1991Jun3.124344.4245@mlb.semi.harris.com>, dcb@dave.mis.semi.harris.com (Dave Brillhart) writes:
|> ccom: Error: /usr/lib/DXM/lib/Xm/Xm.h, line 2017: syntax error
|>       typedef XtPointer (*XmResourceBaseProc)();
|>       -------------------^

This is a common problem for people compiling programs on systems
supporting multiple versions of the X Toolkit.  On DECstations, the Xt
include files in /usr/include/X11 are for the XUI intrinsics.  The
Motif intrinsics (X11R4) include files are in /usr/lib/DXM/lib/Xt/X11
(DXV instead of DXM for VAXes), so you should put a
-I/usr/lib/DXM/lib/Xt in your Makefile.

-- 
Ken Lee
DEC Western Software Laboratory, Palo Alto, Calif.
Internet: klee@wsl.dec.com
uucp: uunet!decwrl!klee

yzarn@lhdsy1.chevron.com (Philip Yzarn de Louraille) (06/06/91)

In article <1991Jun3.124344.4245@mlb.semi.harris.com> dcb@dave.mis.semi.harris.com (Dave Brillhart) writes:
>I've finally found time to start programming in the wonderful
>world of Motif.  A friend recommended the Marshall Brain
>Tutorials (a great tip).  I can't seem to get the first "Hello World"
>program to compile... I'm sure it's some kind of setup problem.
>(BTW, I can compile most other x programs except mxrn. The
>only commonality I could find was mxrn also uses <Xm.h>.)
>
>I'm running Ultrix 4.1 on a DECstation 5000. I loaded OSF/Motif
>1.1. That MAY be the problem right there - I've read 4.1 is based
>on R3 intrinisics while Motiif 1.1 is R4???  Any conformation on
>that?
>
>===========================================================
>ccom: Error: /usr/lib/DXM/lib/Xm/Xm.h, line 2017: syntax error
>      typedef XtPointer (*XmResourceBaseProc)();
>      -------------------^
>ccom: Error: /usr/lib/DXM/lib/Xm/Xm.h, line 2017: function returns
>illegal type
>      typedef XtPointer (*XmResourceBaseProc)();
>      -----------------------------------------^
>ccom: Error: /usr/lib/DXM/lib/Xm/Xm.h, line 2020: syntax error
>          XmResourceBaseProc  base_proc;
>      ---------------------^
>(ccom): /usr/lib/DXM/lib/Xm/Xm.h, line 2020: cannot recover from earlier
>errors: goodbye!
>          XmResourceBaseProc  base_proc;
>      ----------------------------------^
Yes, Ultrix 4.1 is X11R3 but the X librairies delivered with the
software are *supposed* to be X11R4 compatible (?, what is that supposed
to mean?)
Motif 1.1 is X11R4. The third error signifies that the compiler does not
know anything about XmResourceBaseProc. Probably because it is only
found in R4 of X. Why don't you try *linting* your code before compiling
it, you may get more detailed messages. (I always lint before I compile,
saves me lots of time.)
-- 
  Philip Yzarn de Louraille                 Internet: yzarn@chevron.com
  Research Support Division                 Unix & Open Systems
  Chevron Information & Technology Co.      Tel: (213) 694-9232
  P.O. Box 446, La Habra, CA 90633-0446     Fax: (213) 694-7709