Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: dpotlur@hubcap.clemson.edu (Dora Potluri)
Subject: Help on compiling Motif code with C++
Date: Wed, 26 May 1993 01:12:33 GMT	[thread overview]
Message-ID: <1993May26.011233.14929@hubcap.clemson.edu> (raw)

Configuration:
-----------------
DEC Ultrix 4.2a, Motif 1.1.3, C++ 1.2

Hello everyone,
	I am having trouble with compiling C++ code with OSF/Motif 
1.1.3. The program is a very simple one and the compiler gives bunch
of errors as soon as it sees the Xt code. 
	I read CXX man pages and nothing is given as how to compile
OSF/Motif code. Am I missing some thing? 
	I would appreciate if can one can e-mail me on how to 
compile the code.
	Thanx a lot
Potluri
---------------------------------------------------------
----------------------Errors------------------------------
---------------------------------------------------------
sparerib(329)% cxx -o hello hello.C -lXm -lXt -lX11
hello.C:41: error: In this statement, "XtAppInitialize(&app,"Hello",0,0,
...)" s
upplies 9 arguments, but 0 are expected.
hello.C:52: error: In this statement,
"XtCreateManagedWidget("label",xmLabelWidg
etClass,toplevel,args, ...)" supplies 5 arguments, but 0 are expected.
hello.C:61: error: In this statement, "XtRealizeWidget(toplevel)"
supplies 1 arg
ument, but 0 are expected.
hello.C:62: error: In this statement, "XtAppMainLoop(app)" supplies 1
argument,
but 0 are expected.
Compilation terminated with errors.
---------------------------------------------------------
----------------------Program------------------------------
---------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//         This example code is from the book:
//
//           Object-Oriented Programming with C++ and OSF/Motif
//         by
//           Douglas Young
//           Prentice Hall, 1992
//           ISBN 0-13-630252-1	
//
//         Copyright 1991 by Prentice Hall
//         All Rights Reserved
//
//  Permission to use, copy, modify, and distribute this software for 
//  any purpose except publication and without fee is hereby granted, provided 
//  that the above copyright notice appear in all copies of the software.
///////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////


////////////////////////////////////////////////////////
// hello.C, Hello World using C++ and Motif
////////////////////////////////////////////////////////
#include <Xm/Xm.h>
#include <Xm/Label.h>

#if (XlibSpecificationRelease>=5)
void main ( int argc, char **argv )
#else
void main ( unsigned int argc, char **argv )
#endif
{
    Widget       label, toplevel;
    XtAppContext app;
    XmString     xmstr;
    Arg          args[10];
    int          n;
    
    // Initialize the Intrinsics
    
    toplevel = XtAppInitialize ( &app, "Hello", NULL, 0, 
				&argc, argv, NULL, NULL, 0 );
    
    // Create a compound string to display the Hello message
    
    xmstr = XmStringCreateSimple ( "Hello World" );
    
    // Create a label widget to display the string
    
    n = 0;
    XtSetArg ( args[n], XmNlabelString, xmstr ); n++;
    label = XtCreateManagedWidget ( "label", xmLabelWidgetClass,
				   toplevel, args, n );
    
    // Free the compound string when it is no longer needed.
    
    XmStringFree ( xmstr );
    
    // Realize all widgets and enter the main event loop
    
    XtRealizeWidget ( toplevel );
    XtAppMainLoop ( app );
}
-- 
Potluri Dora
Information Systems Lab  
Clemson University
Clemson, sc 29631


                 reply	other threads:[~1993-05-26  1:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox