aed@netcom.COM (Andrew Davidson) (04/04/91)
Hi
For some unkown reason I get the following errors when trying to
compile
the following code using Sun's C++ compiler. I am using sunos 4.1 and
motif
1.1.1. The really strange part is that this code compiles with out any
warnings
and runs correctly when I use g++ 1.37.
Thanks in Advance Andy
CC -c -g -I../../libxs main.cc
CC +g main.cc:
"main.cc", line 28: error: unexpected 1 argument for XtInitialize()
"main.cc", line 34: error: unexpected 1 argument for
XtCreateManagedWidget()
"main.cc", line 35: error: unexpected 1 argument for XtAddCallback()
"main.cc", line 37: error: unexpected 1 argument for
XtRealizeWidget()
----------------------- code --------------------------------
#include <math.h>
#include <iostream.h>
#include <X11/StringDefs.h>
#include <X11/Intrinsic.h>
#include <Xm/Xm.h>
#include <Xm/PushB.h>
#include <Xm/Label.h>
void DoLotsOfWork(Widget w, caddr_t junk, XmPushButtonCallbackStruct
*callData);
int main( int argc, char *argv[])
{
Widget toplevel, button;
toplevel = XtInitialize(argv[0], "BadClient", 0, 0, &argc, argv); //
28
Arg wargs[10];
int n = 0;
XmString label = XmStringCreate("Do Lots of WORK!",
XmSTRING_DEFAULT_CHARSET);
XtSetArg(wargs[n], XmNlabelString, label); n++;
button = XtCreateManagedWidget((String)"button",
xmPushButtonWidgetClass, toplevel, wargs, n); // 34
XtAddCallback(button, XmNactivateCallback, DoLotsOfWork, NULL); //
35
XtRealizeWidget(toplevel); // 37
XtMainLoop();
}
Intrinsic.h defines
typedef char *String;
#define CONST const
typedef unsigned int Cardinal;
extern Widget XtInitialize(
#if NeedFunctionPrototypes
CONST String /* name */,
CONST String /* class */,
XrmOptionDescRec* /* options */,
Cardinal /* num_options */,
Cardinal* /* argc */,
char** /* argv */
#endif
);
for line 34 I tried the following casts but had no luck
toplevel = XtInitialize(
(String)argv[0],
(String)"BadClient",
(XrmOptionDescRec*)0,
(Cardinal)0,
(Cardinal *)&argc,
argv);
--
-----------------------------------------------------------------
"bede-bede-bede Thats all Folks"
Porky Pig
Andy Davidson
Woodside CA.
aed@netcom.COM
-----------------------------------------------------------------