Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!pacbell.com!tandem!netcom!aed From: aed@netcom.COM (Andrew Davidson) Newsgroups: comp.lang.c++ Subject: trouble switching from g++ 1.37 to sun's c++ Message-ID: <1991Apr3.210509.19432@netcom.COM> Date: 3 Apr 91 21:05:09 GMT Organization: Netcom - Online Communication Services UNIX System {408 241-9760 guest} Lines: 92 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 #include #include #include #include #include #include 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 -----------------------------------------------------------------