1834133 Members
1764 Online
110064 Solutions
New Discussion

Compile switch.c Problem

 
SOLVED
Go to solution
Richard Hurley
Occasional Advisor

Compile switch.c Problem

I am trying to compile the switch.c program for CDE workspace switching. I trying to compile on a workstations with 11iV1. I installed the CD Dev Kit.

Here is the source:

/* include files */
#include
#include

#include

/* functions */
void main(int, char**);
void ws_change(Widget widget, Atom aWorkspace, XtPointer client_data);

/* global variables */
static XmString xms;
static Widget toplevel;
static Widget *wWs;
static Atom *paWsSet = NULL;
static unsigned long numWorkspaces;
static Atom *paWs;

static Display *display;
static Window root;
static int screen;
static Widget top, form, top1;
static XtAppContext app_context;
static Arg args[10];
static int n, i, status, pNumWorkspaces;
static Atom *ppaWorkspaces, foundWsAtom = NULL;
static DtWsmWorkspaceInfo *ppWsInfo;
static DtWsmCBContext wsmcontext;
static char *desiredWs;

/* main - main logic for program */
void main (int argc, char **argv)
{

/* initialize toolkit */
n = 0;
XtSetArg (args[n], XmNallowShellResize, True); n++;
XtSetArg (args[n], XtNmappedWhenManaged, False); n++;
toplevel = XtAppInitialize (&app_context, "Dtswitch", NULL, 0,
&argc, argv, NULL, args, n);
display = XtDisplay(toplevel);
screen = DefaultScreen(display);
root = RootWindow(display, screen);
XSynchronize(display, screen);

if ( argc != 2 )
{
printf("must provide name of a workspace to switch to\n");
printf("we'll just monitor workspace changes now\n");
desiredWs = NULL;
}
else
{
desiredWs = argv[1];
}

status = DtWsmGetWorkspaceList(display, root, &ppaWorkspaces,
&pNumWorkspaces);
if (status != Success )
{
printf("problem obtaining workspace list, exiting with status %d\n",
status);
exit(status);
}
/*
printf("Number of workspaces returned is %d\n", pNumWorkspaces);
*/
for (i=0;i{
status = DtWsmGetWorkspaceInfo(display, root, ppaWorkspaces[i],
&ppWsInfo);
if (status != Success )
{
printf("problem getting workspace info %d\n", status);
}
else
{
printf("Workspace %d , title is %s, name is %s\n",i,
ppWsInfo->pchTitle,
XGetAtomName(display,ppWsInfo->workspace));
if ((desiredWs != NULL) &&
(0 == strcmp(desiredWs, ppWsInfo->pchTitle)))
{
foundWsAtom = ppWsInfo->workspace;
}
}
}

wsmcontext = DtWsmAddCurrentWorkspaceCallback(toplevel, ws_change, NULL);
/*
printf("wsmcontext is %d\n", wsmcontext);
*/
XtRealizeWidget (toplevel);

if (foundWsAtom != None)
{
printf("Atom is %x, name is %s\n",
foundWsAtom,XGetAtomName(display, foundWsAtom));
XFlush(display);
status = DtWsmSetCurrentWorkspace(toplevel, foundWsAtom);
XFlush(display);
printf("status is %d\n",status);
/*
if ( status != Success )
{
printf("workspace %s does not exist\n", desiredWs);
}
*/
}
else
printf("Never found a match - workspace doesn't exist\n");
/*
XtAppMainLoop (app_context);
*/
}

void ws_change(Widget widget, Atom aWorkspace, XtPointer client_data)
{
printf("In the change workspace callback\n");
}

Here are the errors:

# /scripts > cc switch.c -o switch
(Bundled) cc: "/usr/include/X11/extensions/Print.h", line 250: error 1000: Unexpected symbol: "*".
(Bundled) cc: "/usr/include/X11/extensions/Print.h", line 252: error 1000: Unexpected symbol: "unsigned".
(Bundled) cc: "/usr/include/X11/extensions/Print.h", line 252: error 1616: Unable to open intrinsic file "/usr/local/lib/sysintr".
(Bundled) cc: "/usr/include/X11/extensions/Print.h", line 253: error 1000: Unexpected symbol: "unsigned".
(Bundled) cc: "/usr/include/X11/extensions/Print.h", line 254: error 1000: Unexpected symbol: "client_data".
(Bundled) cc: "/usr/include/X11/extensions/Print.h", line 254: error 1584: Inconsistent type declaration: "XPointer".
(Bundled) cc: "/usr/include/X11/extensions/Print.h", line 254: warning 525: Redeclaration of identifier "XPointer".
(Bundled) cc: "/usr/include/X11/extensions/Print.h", line 256: error 1000: Unexpected symbol: "*".
(Bundled) cc: "/usr/include/X11/extensions/Print.h", line 259: error 1000: Unexpected symbol: ")".
(Bundled) cc: "/usr/include/X11/extensions/Print.h", line 259: error 1616: Unable to open intrinsic file "/usr/local/lib/sysintr".
(Bundled) cc: "/usr/include/X11/extensions/Print.h", line 290: error 1000: Unexpected symbol: "Display".
(Bundled) cc: "/usr/include/X11/extensions/Print.h", line 291: error 1000: Unexpected symbol: "XPContext".
(Bundled) cc: "/usr/include/X11/extensions/Print.h", line 290: error 1573: Type of "display" is undefined due to an illegal declaration.
(Bundled) cc: "/usr/include/X11/extensions/Print.h", line 290: error 1578: Size of struct or union member is unknown.
(Bundled) cc: "/usr/include/X11/extensions/Print.h", line 291: error 1573: Type of "context" is undefined due to an illegal declaration.
(Bundled) cc: "/usr/include/X11/extensions/Print.h", line 291: error 1578: Size of struct or union member is unknown.
(Bundled) cc: "/usr/include/X11/extensions/Print.h", line 302: error 1000: Unexpected symbol: "Display".
(Bundled) cc: "/usr/include/X11/extensions/Print.h", line 303: error 1000: Unexpected symbol: "XPContext".
(Bundled) cc: "/usr/include/X11/extensions/Print.h", line 302: error 1573: Type of "display" is undefined due to an illegal declaration.
(Bundled) cc: "/usr/include/X11/extensions/Print.h", line 302: error 1578: Size of struct or union member is unknown.
(Bundled) cc: "/usr/include/X11/extensions/Print.h", line 303: error 1573: Type of "context" is undefined due to an illegal declaration.
(Bundled) cc: "/usr/include/X11/extensions/Print.h", line 303: error 1578: Size of struct or union member is unknown.
(Bundled) cc: "/usr/include/X11/extensions/Print.h", line 313: error 1000: Unexpected symbol: "Display".
(Bundled) cc: "/usr/include/X11/extensions/Print.h", line 314: error 1000: Unexpected symbol: "XPContext".
(Bundled) cc: "/usr/include/X11/extensions/Print.h", line 313: error 1573: Type of "display" is undefined due to an illegal declaration.
(Bundled) cc: "/usr/include/X11/extensions/Print.h", line 313: error 1578: Size of struct or union member is unknown.
(Bundled) cc: "/usr/include/X11/extensions/Print.h", line 314: error 1573: Type of "context" is undefined due to an illegal declaration.
(Bundled) cc: "/usr/include/X11/extensions/Print.h", line 314: error 1578: Size of struct or union member is unknown.
(Bundled) cc: "/usr/include/X11/extensions/Print.h", line 552: error 1000: Unexpected symbol: "XpCreateContext".
(Bundled) cc: error 2017: Cannot recover from earlier errors, terminating.

Any C people that can help me out?

Thanks,
Rich
7 REPLIES 7
Peter Godron
Honored Contributor
Solution

Re: Compile switch.c Problem

Rich,
have you spotted Alex Glennies answer in http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1019177

I hope he re-posts it here. Please also read:
http://forums1.itrc.hp.com/service/forums/helptips.do?#28
Arunvijai_4
Honored Contributor

Re: Compile switch.c Problem

Hi Rich,

You can probably try installing HP-UX Develepor's toolkit and try compiling your code again,

http://h20293.www2.hp.com/portal/swdepot/displayProductInfo.do?productNumber=B3394BA

It may help you since it is supported technologies include:

* OSF/Motif 2.1
* X11 R6.2 Xlib
* X11 R6.2 Xt Intrinsics
* X11 R6.2 Athena Widget Set
* Imake
* HP CDE 2.1 (11.00, 11.11 only)
* Audio and imaging multimedia (11.00, 11.11 only)

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Richard Hurley
Occasional Advisor

Re: Compile switch.c Problem

Peter,

Thanks, I just saw the reply to my other thread. I will also assign the points.

Thanks again,

Rich
Richard Hurley
Occasional Advisor

Re: Compile switch.c Problem

Arun,

Yes, I did install the B3394BA.

Thanks,
Rich
Arunvijai_4
Honored Contributor

Re: Compile switch.c Problem

Hi Rich,

Perhaps, you can try installing Ansi C compiler or aCC to compile this program since you were using bundled CC. Just a thought i should say

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Richard Hurley
Occasional Advisor

Re: Compile switch.c Problem

Arun,

Thanks, I got a complied version from Alex.

Rich
Richard Hurley
Occasional Advisor

Re: Compile switch.c Problem

Got compiled version from Alex.