The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


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

More UNIX and Linux Forum Topics 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
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-22-2005
Registered User
 

Join Date: Jan 2005
Posts: 32
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
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
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,354
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
Yeah, I have, but never in the Unix environment.
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 05:53 PM.


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 Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0