Why my code couldn't be compiled


 
Thread Tools Search this Thread
Top Forums Programming Why my code couldn't be compiled
# 1  
Old 02-22-2005
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
# 2  
Old 02-22-2005
I've never been able to execute a single sample program in the book on X programming.
# 3  
Old 02-22-2005
Do I need to install some packages to enable Motif?
# 4  
Old 02-22-2005
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.
# 5  
Old 02-23-2005
Yeah, I have, but never in the Unix environment.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

[Solved] Using ULL suffix in C++ code compiled on RHEL6.4

Hi, I am trying to compile a piece of c++ code using the g++ compiler on an RHEL6.4 system. Here is a code snippet: #define CDMA_TIME_OFFSET 315964800000ULL unsigned long long int ABC=CDMA_TIME_OFFSET; For some reason, the value assigned to ABC is only the LSB 32-bit of... (2 Replies)
Discussion started by: ankit_ka
2 Replies

2. Solaris

Symbol reference error for same code & libraries but compiled in different environmen

Hi All, I am having a code written in C++.First I build this code on SUN 5.10.It was built successfully.Following is the log when build was successful. -L/apps/compilers/SUNWspro/lib -lm -lsunmath \ -o App ld: warning: symbol `clog' has differing types: (file... (0 Replies)
Discussion started by: milindb
0 Replies

3. UNIX for Advanced & Expert Users

cannot run c compiled programs

iam in the way of making graphics using SDL.i copied from cd usign mount -a /cdrom cd /cdrom cp SDL-1.2.11.tar.gz /usr/test cd /usr/test gunzip SDL-1.2.11.tar.gz tar -xf SDL-1.2.11.tar cd SDL-1.2.11 ./configure ... ... it stops at checking whether the c compiler... (4 Replies)
Discussion started by: kumarangopi
4 Replies

4. Programming

Can C determine which OS it's being compiled on?

Hello all! I've searched the archives, google, documentation and I can't seem to find any answer regarding my question. Our code has to be lint free and due to the following lint warning ---> logical expression always true: op "||" <--- we are forced to #include <note.h > (which appears to be... (3 Replies)
Discussion started by: quattro20v
3 Replies

5. UNIX for Advanced & Expert Users

crontab couldn't run through, help

I have created two scripts to call SQL scripts to do some work. The scripts was successfully executed many times by manual. When I scheduled two scripts in crontab, I gave all necessary parameters. It could start, but couldn't run through. The log file didn't give enough error info. Anyone can help... (10 Replies)
Discussion started by: duke0001
10 Replies

6. Linux

Couldn't connect to Internet

I have installed fedora core 7 in my system. When I try to activate the network card it says "Could not determine IP address for eth0...failed". Please give me suggestions? (2 Replies)
Discussion started by: mvictorvijayan
2 Replies

7. Programming

How to use a .exe with a compiled program.

I am confused about how to use a .exe file in unix along with a compiled C++ program. I've been using emacs and I compiled with g++, but I have no idea how that relates to use with a .exe. (1 Reply)
Discussion started by: adamsy
1 Replies

8. UNIX for Dummies Questions & Answers

Compiled Compiler

I've got Solaris9 and it comes with no compiler. I've downloaded gcc from GNU, but you can't compile the files without the compiler (chicken before the egg situation). Some sites point to an ftp site of ftp.ai.prep.mit.edu where a compiled version of the GNU gcc exists, but when I have gone there... (3 Replies)
Discussion started by: AJA
3 Replies

9. UNIX for Advanced & Expert Users

Compiled Files

I am using SCO Unix with a Progress Database. There are files that 'pop up' and cause problems. I need to be able to read these files but they are compiled and I don't know how to un-compile them. Is there some kind of software / shareware that I can download to view these files? Is... (2 Replies)
Discussion started by: tripp4337
2 Replies

10. Programming

Running a compiled Program

Just getting into the Unix command line programming and am unable to run any program I write. I am using a Makefile and the source is compiling but when I enter the name of the output file I get back: bash: lab01exe.out: command not found I'm sure I am just dooing something simple... (2 Replies)
Discussion started by: Krebsbac
2 Replies
Login or Register to Ask a Question