gold_marigold55
04-24-2005, 11:56 PM
Hi,
I wrote a makefile for compiling my c program, the file is as following:
/* begining */
sftp: main.o my_header.o connect.o
cc -o main.o my_header.o connect.o -lnsl -lsocket
main.o: main.c
cc -c main.c
my_header.o: my_header.c
cc -c my_header.c my_header.h
/* ended */
Please note that the main.c and my_header.c include my_header.h and I got the error as:
% make
cc -c main.c my_header.c
main.c:
my_header.c:
cc -o main.o my_header.o connect.o -lsocket -lnsl
Undefined first referenced
symbol in file
main /opt/SUNWspro/prod/lib/crt1.o
ld: fatal: Symbol referencing errors. No output written to main.o
make: *** [sftp] Error 1
%
Could u please tell me what this means? And how to fix it?
Also I don't know how to use "Code TAGS" to put my code in order more readable, where can I find instructions?
Thanks.
:confused: Gold_marigold
I wrote a makefile for compiling my c program, the file is as following:
/* begining */
sftp: main.o my_header.o connect.o
cc -o main.o my_header.o connect.o -lnsl -lsocket
main.o: main.c
cc -c main.c
my_header.o: my_header.c
cc -c my_header.c my_header.h
/* ended */
Please note that the main.c and my_header.c include my_header.h and I got the error as:
% make
cc -c main.c my_header.c
main.c:
my_header.c:
cc -o main.o my_header.o connect.o -lsocket -lnsl
Undefined first referenced
symbol in file
main /opt/SUNWspro/prod/lib/crt1.o
ld: fatal: Symbol referencing errors. No output written to main.o
make: *** [sftp] Error 1
%
Could u please tell me what this means? And how to fix it?
Also I don't know how to use "Code TAGS" to put my code in order more readable, where can I find instructions?
Thanks.
:confused: Gold_marigold