The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM
Home Forums Register Rules & FAQ Members List Arcade Search Today's Posts Mark Forums Read


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.


Other UNIX.COM Threads You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
cannot run c compiled programs kumarangopi UNIX for Advanced & Expert Users 3 11-28-2006 04:09 AM
How to use a .exe with a compiled program. adamsy High Level Programming 1 10-03-2005 09:03 PM
Compiled Compiler AJA UNIX for Dummies Questions & Answers 3 11-10-2003 09:39 AM
Compiled Files tripp4337 UNIX for Advanced & Expert Users 2 09-13-2003 11:23 AM
Running a compiled Program Krebsbac High Level Programming 2 09-07-2001 01:39 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-22-2005
Registered User
 

Join Date: Jan 2005
Posts: 32
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Why my code couldn't be compiled

Code:
#include <Xm/Xm.h>
#include <Xm/PushB.h>

Widget CreatePushbutton(Widget parent,
			char* name,
			XtCallbackProc callback,
			XtPointer client_data)
{
  Widget push;
  Arg args[20];
  Cardinal n;

  n=0;
  push=XmCreatePushButton(parent,
			  name, args, n);

  XtAddCallback(push,
		XmNactivateCallback,
		callback,
		client_data);

  XtManageChild(push);
  return push;
}
I got the following error message:
Quote:
cd ~/
gcc -g X_Programming.c -o X_Programming -lm
Undefined first referenced
symbol in file
main /usr/local/stow/gcc/gcc-2.95.2-2/lib/gcc-lib/sparc-sun-solaris2.7/2.95.2/crt1.o
XmCreatePushButton /var/tmp/ccyfsC2Z.o
XtManageChild /var/tmp/ccyfsC2Z.o
XtAddCallback /var/tmp/ccyfsC2Z.o
_XmStrings /var/tmp/ccyfsC2Z.o
ld: fatal: Symbol referencing errors. No output written to X_Programming
collect2: ld returned 1 exit status

Compilation exited abnormally with code 1 at Tue Feb 22 13:27:35
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 02-22-2005
Registered User
 

Join Date: Jan 2005
Posts: 32
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
I've never been able to execute a single sample program in the book on X programming.
Reply With Quote
  #3 (permalink)  
Old 02-22-2005
Registered User
 

Join Date: Jan 2005
Posts: 32
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Do I need to install some packages to enable Motif?
Reply With Quote
  #4 (permalink)  
Old 02-22-2005
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,206
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
For one thing, you don't even have a main() in that file, but you're compiling it as if it was a program. Have you ever written a c program? The other errors have to do with libraries you didn't bother to specify.
Reply With Quote
  #5 (permalink)  
Old 02-22-2005
Registered User
 

Join Date: Jan 2005
Posts: 32
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Yeah, I have, but never in the Unix environment.
Reply With Quote
Google UNIX.COM
Reply



Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7. The time now is 02:36 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger

Search Engine Optimization by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102