Unix Technical Forum

gcc - what's wrong

This is a discussion on gcc - what's wrong within the Slackware Linux Support forums, part of the Unix Operating Systems category; --> Someone sent me this.... /* Print the Mandlebrot set C code by Glenn Rhoads */ main(){ int x, y, ...


Go Back   Unix Technical Forum > Unix Operating Systems > Slackware Linux Support

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-19-2008, 08:12 AM
Rob
 
Posts: n/a
Default gcc - what's wrong

Someone sent me this....

/* Print the Mandlebrot set
C code by Glenn Rhoads
*/
main(){

int x, y, k;

char *b = " .:,;!/>)|&IH%*#";

float r, i, z, Z, t, c, C;

for (y=30; puts(""), C = y*0.1 - 1.5, y--{

for (x=0; c = x*0.04 - 2, z=0, Z=0, x++ < 75{

for (r=c, i=C, k=0; t = z*z - Z*Z + r, Z = 2*z*Z + i, z=t,
k<112; k++)

if (z*z + Z*Z > 10) break;

printf ("%c", b[k%16]);

}
}
}

....and told me to compile it with gcc but I'm getting all sorts of errors on
Slack 7.1

root@Chappell:/home/rob# gcc mandelbrot.c
/usr/lib/libc_nonshared.a(elf-init.oS): In function `__libc_csu_init':
elf-init.oS(.text+0xd): undefined reference to `__init_array_end'
elf-init.oS(.text+0x12): undefined reference to `__init_array_start'
elf-init.oS(.text+0x23): undefined reference to `__init_array_start'
/usr/lib/libc_nonshared.a(elf-init.oS): In function `__libc_csu_fini':
elf-init.oS(.text+0x32): undefined reference to `__fini_array_end'
elf-init.oS(.text+0x37): undefined reference to `__fini_array_start'
elf-init.oS(.text+0x5b): undefined reference to `__fini_array_start'
collect2: ld returned 1 exit status

Any ideas what's wrong - it's beyond me.

Cheers
Rob


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-19-2008, 08:12 AM
Wild Wizard
 
Posts: n/a
Default Re: gcc - what's wrong

Rob wrote:

> Someone sent me this....


> Any ideas what's wrong - it's beyond me.


add

#include <stdio.h>

to the start of the c file thats all that is missing, and btw thats so cool
fractals in acsi art

.................::::::::::::::::::::::::::::::::: :::::::::::...............
............:::::::::::::::::::::::::::::::::::::: ::::::::::::::::..........
.........::::::::::::::::::::::::::::::::::,,,,,,, :::::::::::::::::::.......
......:::::::::::::::::::::::::::::,,,,,,,,,,,,,,, ,,,,,,,:::::::::::::::....
....::::::::::::::::::::::::::,,,,,,,,,,,,;;;!:H!! ;;;,,,,,,,,:::::::::::::..
:::::::::::::::::::::::::,,,,,,,,,,,,,;;;;!!/>&*|& !;;;,,,,,,,:::::::::::::
::::::::::::::::::::::,,,,,,,,,,,,,;;;;;!!//)|.*#|>/!;;;;;,,,,,,:::::::::::
::::::::::::::::::,,,,,,,,,,,,;;;;;;!!!!//>|: !:|//!!;;;;;,,,,,:::::::::
:::::::::::::::,,,,,,,,,,;;;;;;;!!/>>I>>)||I# H&))>////*!;;,,,,::::::::
::::::::::,,,,,,,,,,;;;;;;;;;!!!!/>H: #| IH&*I#/;;,,,,:::::::
::::::,,,,,,,,,;;;;;!!!!!!!!!!//>|.H: #I>!!;;,,,,::::::
:::,,,,,,,,,;;;;!/||>///>>///>>)|H %|&/;;,,,,,:::::
:,,,,,,,,;;;;;!!//)& .;I*,H#&||&/ *)/!;;,,,,,::::
,,,,,,;;;;;!!!//>)IH:, ## #&!!;;,,,,,::::
,;;;;!!!!!///>)H%.** * )/!;;;,,,,,::::
H *!|* &>: &)/!!;;;,,,,,::::
,;;;;!!!!!///>)H%.** * )/!;;;,,,,,::::
,,,,,,;;;;;!!!//>)IH:, ## #&!!;;,,,,,::::
:,,,,,,,,;;;;;!!//)& .;I*,H#&||&/ *)/!;;,,,,,::::
:::,,,,,,,,,;;;;!/||>///>>///>>)|H %|&/;;,,,,,:::::
::::::,,,,,,,,,;;;;;!!!!!!!!!!//>|.H: #I>!!;;,,,,::::::
::::::::::,,,,,,,,,,;;;;;;;;;!!!!/>H: #| IH&*I#/;;,,,,:::::::
:::::::::::::::,,,,,,,,,,;;;;;;;!!/>>I>>)||I# H&))>////*!;;,,,,::::::::
::::::::::::::::::,,,,,,,,,,,,;;;;;;!!!!//>|: !:|//!!;;;;;,,,,,:::::::::
::::::::::::::::::::::,,,,,,,,,,,,,;;;;;!!//)|.*#|>/!;;;;;,,,,,,:::::::::::
:::::::::::::::::::::::::,,,,,,,,,,,,,;;;;!!/>&*|& !;;;,,,,,,,:::::::::::::
....::::::::::::::::::::::::::,,,,,,,,,,,,;;;!:H!! ;;;,,,,,,,,:::::::::::::..
......:::::::::::::::::::::::::::::,,,,,,,,,,,,,,, ,,,,,,,:::::::::::::::....
.........::::::::::::::::::::::::::::::::::,,,,,,, :::::::::::::::::::.......
............:::::::::::::::::::::::::::::::::::::: ::::::::::::::::..........

--
One Page Principle:
A specification that will not fit on one page of 8.5x11 inch
paper cannot be understood.
-- Mark Ardis

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-19-2008, 08:15 AM
Claudiu Cismaru
 
Posts: n/a
Default Re: gcc - what's wrong

> root@Chappell:/home/rob# gcc mandelbrot.c
> /usr/lib/libc_nonshared.a(elf-init.oS): In function `__libc_csu_init':
> elf-init.oS(.text+0xd): undefined reference to `__init_array_end'
> elf-init.oS(.text+0x12): undefined reference to `__init_array_start'
> elf-init.oS(.text+0x23): undefined reference to `__init_array_start'
> /usr/lib/libc_nonshared.a(elf-init.oS): In function `__libc_csu_fini':
> elf-init.oS(.text+0x32): undefined reference to `__fini_array_end'
> elf-init.oS(.text+0x37): undefined reference to `__fini_array_start'
> elf-init.oS(.text+0x5b): undefined reference to `__fini_array_start'
> collect2: ld returned 1 exit status


Do you have glibc package installed? This is not an #include issue, it's
a library one. I suppose that you have missing glibc for development.
Or you have incompatibility between some libraries?

--
Claudiu Cismaru

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
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
Forum Jump


All times are GMT. The time now is 09:52 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com