[net.lang.c++] complex artihmetic again

merworth@ut-ngp.UUCP (07/11/86)

First, thanks to everyone who responded to my posting about
the complex arithmetic problem.  I added the -lm flag to include
the math library.  Now I have a new set of problems with the
same program.  At first I thought it was due to the fact that
the CC script allowed a command line of the form (which it should):

	CC test.c -lC -lm

but when passed to cc, the -lC flag was added again.

	cc   test..c -lC -lm -lC

But I modified the CC script to not include any libraries as default.
Either way, I get the same error messages.

My command line: CC test.c -lC -lm

	CC  test.c:
	cc   test..c -lC -lm 
	__ctors: ld:__ctdt.o: multiply defined
	__dtors: __ctdt.o: multiply defined

Please excuse me if I am just overlooking something obvious.  If I take
the test.o file and load it manually, I get an executable file but it
gives a "Bus error core dump" when executed. 

	ld -X /lib/crt0.o test.o -lC -lm -lc

Thanks for any help.
-- 
Boyd Merworth
The University of Texas at Austin, Computation Center,   Austin, TX 78712
merworth@ngp.cc.utexas.edu 	 {ihnp4,allegra,ut-sally}!ut-ngp!merworth
				 	       {seismo}!ut-sally!merworth

kana@patty.UUCP (07/15/86)

> My command line: CC test.c -lC -lm
> 
> 	CC  test.c:
> 	cc   test..c -lC -lm 
> 	__ctors: ld:__ctdt.o: multiply defined
> 	__dtors: __ctdt.o: multiply defined

I found that CC executes the following commands:

/lib/cpp -C -I/usr/include/CC test.c | cfront +L +ftest.c > test..c
cc -c test..c -lC -lm
mv test..o test.o
cc test.o -lC -lm -lC
nm a.out | munch > __ctdt.c
cc -c __ctdt.c
cc test.o -lC -lm __ctdt.o -lC

If the last line is
	cc test.o __ctdt.o -lC -lm -lC
we can get a correct executable a.out.

I am using the following command, because I don't dare to rewrite CC.

From sh:
	LIBRARY="-lC -lm" CC test.c

From csh:
	setenv LIBRARY "-lC -lm"
	CC test.c
-- 
Katsumi Kanasaki
Software Research Center, Ricoh Co., Ltd.
PHONE: (03)815-7261
JUNET: kana@charlie.ricoh.junet
UUCP: ...!{hplabs,mcvax}!kddlab!titcca!koccvax!kossvax!patty!charlie!kana