home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / windows / x / intrinsi / 677 next >
Encoding:
Text File  |  1992-12-22  |  2.6 KB  |  113 lines

  1. Path: sparky!uunet!haven.umd.edu!darwin.sura.net!spool.mu.edu!hri.com!ukma!cs.widener.edu!dsinc!ub!acsu.buffalo.edu!qizeng
  2. From: qizeng@acsu.buffalo.edu (Qi Y. Zeng)
  3. Newsgroups: comp.windows.x.intrinsics
  4. Subject: problem with intrinsics.h
  5. Message-ID: <BzMsG8.8vL@acsu.buffalo.edu>
  6. Date: 21 Dec 92 22:43:20 GMT
  7. Sender: nntp@acsu.buffalo.edu
  8. Organization: UB
  9. Lines: 101
  10. Nntp-Posting-Host: lictor.acsu.buffalo.edu
  11.  
  12. Dear Netters:
  13.     I have run an X_window program but I have found 
  14. some problems there.
  15.     This program is from the book "X window System--
  16. Programming and applications with Xt" by Douglas A.
  17. Young.
  18.     I send the program and the error message to you
  19. and hope you can help me to solve this problem.
  20.     With best regards and many thanks.
  21.  
  22.                                   Qizeng
  23.  
  24. I type the following to run the program:
  25.  
  26. cc memo.c concat.c -lX11 -L/util/X11/lib
  27.  
  28.  
  29. The error message is as follows:
  30.  
  31.  
  32. memo.c: 2: Can't find include file X11/Instrinsic.h
  33. /util3/X11/include/Xw/Xw.h: 80: XtRTranslationTable redefined
  34. /util3/X11/include/Xw/Xw.h: 302: XtNinsertPosition redefined
  35. /util3/X11/include/Xw/Xw.h: 307: XtNselectionArray redefined
  36. /util3/X11/include/Xw/Xw.h: 308: XtNtextSource redefined
  37. /util3/X11/include/Xw/Xw.h: 309: XtNselection redefined
  38. /util3/X11/include/Xw/Xw.h: 313: XtNeditType redefined
  39. /util3/X11/include/Xw/Xw.h: 314: XtNfile redefined
  40. /util3/X11/include/Xw/Xw.h: 315: XtNstring redefined
  41. /util3/X11/include/Xw/Xw.h: 316: XtNlength redefined
  42. /util3/X11/include/Xw/Xw.h: 317: XtNfont redefined
  43. concat.c:
  44.  
  45.  
  46. he program is as follows:
  47.  
  48. memo.c is
  49.  
  50. #include<X11/Instrinsic.h>
  51. #include<X11/StringDefs.h>
  52. #include</util3/X11/include/Xw/Xw.h>
  53. #include</util3/X11/include/Xw/SText.h>
  54. #include<stdio.h>
  55.  
  56. extern char *concat_args();
  57. main(argc,argv)
  58.  
  59.      int argc;
  60.      char *argv[];
  61.  
  62. {
  63.   Widget toplevel,msg_widget;
  64.   Arg wargs[];
  65.   int n;
  66.   char *message;
  67.  
  68.   toplevel=XtInitialize(argv[0],"memo",NULL,0,&argc,argv);
  69.  
  70.   n=0;
  71.   if((message=concat_args(argc,argv))!=NULL){
  72.     XtSetArg(wargs[n],XtNstring,message);n++;
  73.   }
  74.   
  75.   msg_widget=XtCreatManageWidget("message",XwstatictextWidgetClass,toplevel,
  76.                  wargs,n);
  77.  
  78.   XtRealizeWidget(toplevel);
  79.   XtMainLoop();
  80. }
  81.  
  82.  
  83. concat.c is:
  84.  
  85.  
  86. #include<stdio.h>
  87. char *concat_args(n,words)
  88.      int n;
  89.      char *words[];
  90. {
  91.   char *buffer;
  92.   int i,len=0;
  93.   
  94.   if(n<=1)
  95.     return("");
  96.   for(i=1;i<n;i++)
  97.     len+=strlen(words[i]);
  98.   len+=(n-1);
  99.   buffer=(char *)malloc(len+1);
  100.   if(buffer==NULL){
  101.     fprint(stderr,"out\n");
  102.     exit(1);
  103.   }
  104.   buffer[0]='\0';
  105.  
  106.   for(i=1;i<n;i++){
  107.     if(i>1)
  108.       strcat(buffer," ");
  109.     strcat(buffer,words[i]);
  110.   }
  111.   return (buffer);
  112. }
  113.