ERROR I HAVE NO CLUE WHAT IT MEANS 
Author Message
 ERROR I HAVE NO CLUE WHAT IT MEANS

I am pretty new to programming.

After I compile my code i receive this error

/tmp/ccdygCy1.o: In function `main':
/tmp/ccdygCy1.o(.text+0x66): undefined reference to `displayresult'
collect2: ld returned 1 exit status

This is my program.  Can anyone please help me what with what I am
doing wrong.  I appreciate it.  Thank you....

/**************************************
*
*
*
*
*
*
*************************************/

#include <stdio.h>
#include <stdlib.h>

#define MAX_ELEMENTS 1000
#define ANLS_RNG 7

int getdata (int data [], int size, int range);
void printdata(int data [], int size, int linesize);
void makefreq(int data [], int size, int count [], int range);
void displayresult (int freq[]);

int main (void)
{

int size;
int data [MAX_ELEMENTS];
int count [ANLS_RNG];

        size = getdata ( data, MAX_ELEMENTS, ANLS_RNG);
        printdata (data, size, 10);
        makefreq (data, size, count, ANLS_RNG);

        displayresult (count);
return ;

Quote:
}

int getdata (int data [], int size, int range)
{
        int datain;
        int loader = 0;
        FILE *fpdata;

        if((fpdata = fopen ("input.dat", "r")) == NULL)
         {
                printf("Error opening file\a\a\n"), exit(100);
         }
        else
         {
                printf("\n");
         }
   while(( loader < size) && (fscanf(fpdata, "%d", &datain) ==1))
        {
                data [loader++] = datain;
        }
   if (loader ==size)
        printf("Process.\n");
        else
          printf("\n");
        return loader;

Quote:
}

void printdata (int data [], int size, int linesize)
{
int i;
int numberprinted = 0;

        printf("\n\n");
        for (i=0; i < size; i++)
        {
                numberprinted++;
        printf("%5d", data [i]);
        if (numberprinted >= 10)
                {
                printf("\n");
                numberprinted = 0;
                }
        }
        return;

Quote:
}

void makefreq(int data [], int size, int count [], int range)

{

        int h;
        int i;
        int a =1;
        int b =1;
        int c =1;
        int d =1;
        int e=1;
        int f = 1;
        int j = 1;

        for ( h= 0; h < range; h++)
        count [h] =0;
        for (i=0; i < size; i++)
        {
        if (data [i]<0)
           { count [0] = a;
             a++;
           }
        else if (data [i]>=0 && data [i] <=19)
           { count [1] = b;
             b++;
           }
        else if (data [i]>=20 && data [i] <= 39)
           { count [2] = c;
             c++;
           }
        else if (data [i]>=40 && data [i]<=59)
           { count [3] = d;
             d++;
           }
        else if (data [i]>=60 && data [i]<=79)
           { count [4] = e;
             e++;
           }
        else if (data [i]>= 80 && data [i]<= 99)
           { count [5] = f;
             f++;
           }
        else if ( data [i] > 99)
           {  count [6] = j;
              j++;
           }
        }
return;

Quote:
}

void dispplayresult ( int count [])

{

        int j;
        int datain;
        int closeresult;

        FILE  *fpout;

        FILE *fpdata;

fpout = fopen ("Output.dat", "w");

   if (!fpout)
        { printf("Could not open output file\a\n");
          exit (102);
        }
   printf("Classification of integers\n");

   fprintf(fpout, "Classification of integers\n");

        printf("\n \t less then 0 \t\t %2d", count [0]);
        fprintf(fpout,"\n\t less than 0 \t\t %2d", count [0]);

for (j=1; j<= count [0]; j++)

        {
        printf("*");
        fprintf(fpout, "*");
        }
        printf("\n");
        fprintf(fpout, "\n");

        printf("\n\t between 0 and 19 \t %2d", count [1]);
        fprintf(fpout, "\n\t between 0 and 19 \t %2d", count [1]);

for (j=1; j<= count [1]; j++)

        {
         printf("*");
         fprintf(fpout,"*");
        }
        printf("\n");
        fprintf(fpout, "\n");

        printf("\n\t between 20 and 39\t %2d", count [2]);
        fprintf(fpout, "\n\t between 20 and 39\t %2d", count [2]);

for (j=1; j <= count [2]; j++)
        {
        printf("*");
        fprintf(fpout,"*");
        }
        printf("\n");
        fprintf(fpout, "*");

        printf("\n\t between 40 and 59\t %2d", count [3]);
        fprintf(fpout, "\n\t between 40 and 59\t %2d", count [3]);

for (j=1; j<= count [3]; j++)

        {
        printf("*");
        fprintf(fpout, "*");
        }

        printf("\n");
        fprintf(fpout, "\n");

        printf("\n\t between 60 and 79\t %2d", count [4]);
        fprintf(fpout, "between 60 and 79\t %2d", count [4]);

for (j=1; j<= count [4]; j++)

        {
        printf("\n");
        fprintf(fpout, "\n");
        }

        printf("\n");
        fprintf(fpout, "\n");

        printf("\n\t between 80 and 99\t %2d", count [5]);
        fprintf(fpout, "\n\t between 80 and 99\t %2d", count [5]);

for (j=1; j<=count [5]; j++)
         {
         printf("*");
        fprintf(fpout,"*");
         }
        printf("\n");
        fprintf(fpout, "\n");

        printf("\n\t greater than 99\t %3d", count [6]);
        fprintf(fpout, "\n\t greater than 99\t %3d", count [6]);

for (j=1; j<= count [6]; j++)

        {
        printf("*");
        fprintf(fpout, "*");
        }

        printf("\n");
        fprintf(fpout, "\n");

closeresult = fclose (fpout);

if (closeresult == EOF)

        {
        printf(" Could not close output file\a\n");
        exit (201);
        }

printf ("file copy complete\n\n");
        return;

Quote:
}



Thu, 25 Aug 2005 02:38:39 GMT  
 ERROR I HAVE NO CLUE WHAT IT MEANS

Quote:

> After I compile my code i receive this error

> /tmp/ccdygCy1.o(.text+0x66): undefined reference to `displayresult'

You called a function named displayresult, but you never defined
a function by that name.
--
int main(void){char p[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.\
 \n",*q="kl BIcNBFr.NKEzjwCIxNJC";int i=sizeof p/2;char *strchr();int putchar(\
);while(*q){i+=strchr(p,*q++)-p;if(i>=(int)sizeof p)i-=sizeof p-1;putchar(p[i]\
);}return 0;}


Thu, 25 Aug 2005 02:47:30 GMT  
 ERROR I HAVE NO CLUE WHAT IT MEANS

Quote:

> /tmp/ccdygCy1.o(.text+0x66): undefined reference to `displayresult'
> void displayresult (int freq[]);
>         displayresult (count);
> void dispplayresult ( int count [])

           ^

Matthew

--
Rapun.sel - outermost outpost of the Pick Empire
http://www.pick.ucam.org



Thu, 25 Aug 2005 02:56:13 GMT  
 ERROR I HAVE NO CLUE WHAT IT MEANS

Quote:

> I am pretty new to programming.

> After I compile my code i receive this error

> /tmp/ccdygCy1.o: In function `main':
> /tmp/ccdygCy1.o(.text+0x66): undefined reference to `displayresult'
> collect2: ld returned 1 exit status
> void dispplayresult ( int count [])

           ^^
    The compiler doesn't correct spelling errors.


Thu, 25 Aug 2005 04:47:59 GMT  
 ERROR I HAVE NO CLUE WHAT IT MEANS

Quote:
> I am pretty new to programming.

> After I compile my code i receive this error

> /tmp/ccdygCy1.o: In function `main':
> /tmp/ccdygCy1.o(.text+0x66): undefined reference to `displayresult'
> collect2: ld returned 1 exit status

> This is my program.  Can anyone please help me what with what I am
> doing wrong.  I appreciate it.  Thank you....

<snip>

Quote:
> void displayresult (int freq[]);
>      displayresult (count);
> void dispplayresult ( int count [])

Sometimes it's just a typo.


Thu, 25 Aug 2005 05:21:26 GMT  
 ERROR I HAVE NO CLUE WHAT IT MEANS

Quote:


> > I am pretty new to programming.

> > After I compile my code i receive this error

> > /tmp/ccdygCy1.o: In function `main':
> > /tmp/ccdygCy1.o(.text+0x66): undefined reference to `displayresult'
> > collect2: ld returned 1 exit status

> > void dispplayresult ( int count [])
>            ^^
>     The compiler doesn't correct spelling errors.

I think compiler of future (not so far) will have this intelligence
to warn user of such a mistake.
So if the linker fails it will look at the source and will do some kind
of proximity analysis to indicate "possible" typos.


Thu, 25 Aug 2005 13:11:23 GMT  
 ERROR I HAVE NO CLUE WHAT IT MEANS

Quote:
> /tmp/ccdygCy1.o: In function `main':
> /tmp/ccdygCy1.o(.text+0x66): undefined reference to `displayresult'
> collect2: ld returned 1 exit status
>         displayresult (count);

<...>

Quote:
> void dispplayresult ( int count [])

--
-ed- emdel at noos.fr ~]=[o
FAQ de f.c.l.c : http://www.isty-info.uvsq.fr/~rumeau/fclc/
C-library: http://www.dinkumware.com/manuals/reader.aspx

"Say 'No' to the war!" http://www.votenowar.org/



Thu, 25 Aug 2005 19:17:50 GMT  
 ERROR I HAVE NO CLUE WHAT IT MEANS

Quote:
> I think compiler of future (not so far) will have this intelligence
> to warn user of such a mistake.
> So if the linker fails it will look at the source and will do some kind
> of proximity analysis to indicate "possible" typos.

My ol'good Borland C 3.1 (1991) warned me about using a function without
prototype. That's enough to me to watch the code closer.

--
-ed- emdel at noos.fr ~]=[o
FAQ de f.c.l.c : http://www.isty-info.uvsq.fr/~rumeau/fclc/
C-library: http://www.dinkumware.com/manuals/reader.aspx

"Say 'No' to the war!" http://www.votenowar.org/



Thu, 25 Aug 2005 19:23:43 GMT  
 ERROR I HAVE NO CLUE WHAT IT MEANS


Quote:


>> > I am pretty new to programming.

>> > After I compile my code i receive this error

>> > /tmp/ccdygCy1.o: In function `main':
>> > /tmp/ccdygCy1.o(.text+0x66): undefined reference to `displayresult'
>> > collect2: ld returned 1 exit status

>> > void dispplayresult ( int count [])
>>            ^^
>>     The compiler doesn't correct spelling errors.

>I think compiler of future (not so far) will have this intelligence
>to warn user of such a mistake.
>So if the linker fails it will look at the source and will do some kind
>of proximity analysis to indicate "possible" typos.

I don't think so. Where's the motivation? Only so that inexperienced
programmers don't have to understand what "undefined reference" means.
Not to mention the possible false alarms you could get.

An error message that says:

"Hmmm, you defined a function called "dispplayresult", but you have an
reference to a function called "displayresult", this might be a typo"

might be useful, but "undefined reference to `displayresult'" tells me
the same thing more or less.

No criticism intended of the original poster. You will encounter this
error many times in the future, this is just the first time.

The important information is that "undefined reference" means you
"referred" (by calling it) to something (a function called
displayresult) that was not "defined".

Sorry for the heavy use of "quotes".



Thu, 25 Aug 2005 19:24:56 GMT  
 ERROR I HAVE NO CLUE WHAT IT MEANS

Quote:

>I am pretty new to programming.

>After I compile my code i receive this error

>/tmp/ccdygCy1.o: In function `main':
>/tmp/ccdygCy1.o(.text+0x66): undefined reference to `displayresult'
>collect2: ld returned 1 exit status

You have a spelling mistake.

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>



Fri, 26 Aug 2005 05:33:34 GMT  
 ERROR I HAVE NO CLUE WHAT IT MEANS

Quote:
>>I think compiler of future (not so far) will have this intelligence
>>to warn user of such a mistake.
>>So if the linker fails it will look at the source and will do some kind
>>of proximity analysis to indicate "possible" typos.

> I don't think so. Where's the motivation? Only so that inexperienced
> programmers don't have to understand what "undefined reference" means.
> Not to mention the possible false alarms you could get.

Hmm, while not a C compiler, the GNAT (Ada95) compiler does this:

-- Cooky.adb
with Ada.Text_Io;
use  Ada.Text_Io;

procedure Cooky
is
begin
        Put_Lien ("GNAT caught this?");
end Cooky;

$ gnatmake -gnatf -gnatwa cooky.adb
gcc-3.2 -c -gnatf -gnatwa cooky.adb
cooky.adb:1:09: warning: no entities of "Text_Io" are referenced
cooky.adb:7:09: "Put_Lien" is undefined
cooky.adb:7:09: possible misspelling of "Put_Line"
gnatmake: "cooky.adb" compilation error



Fri, 26 Aug 2005 13:20:31 GMT  
 ERROR I HAVE NO CLUE WHAT IT MEANS


Quote:
> I am pretty new to programming.

> After I compile my code i receive this error

> /tmp/ccdygCy1.o: In function `main':
> /tmp/ccdygCy1.o(.text+0x66): undefined reference to `displayresult'
> collect2: ld returned 1 exit status

It says "you have not defined anything called 'displayresult'". It's
right. Later we see:

Quote:
> void dispplayresult ( int count [])

Incidentally, your code looks awful - lots of repetition and failure
to abstract. If you want more detailed comments, ask.

--
Chris "electric hedgehog" Dollin
C FAQs at: http://www.faqs.org/faqs/by-newsgroup/comp/comp.lang.c.html
C welcome: http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html



Fri, 26 Aug 2005 17:10:42 GMT  
 ERROR I HAVE NO CLUE WHAT IT MEANS
On Mon, 10 Mar 2003 05:20:31 GMT, "Eric G. Miller"

Quote:


>>>I think compiler of future (not so far) will have this intelligence
>>>to warn user of such a mistake.
>>>So if the linker fails it will look at the source and will do some kind
>>>of proximity analysis to indicate "possible" typos.

>> I don't think so. Where's the motivation? Only so that inexperienced
>> programmers don't have to understand what "undefined reference" means.
>> Not to mention the possible false alarms you could get.

>Hmm, while not a C compiler, the GNAT (Ada95) compiler does this:

>-- Cooky.adb
>with Ada.Text_Io;
>use  Ada.Text_Io;

>procedure Cooky
>is
>begin
>        Put_Lien ("GNAT caught this?");
>end Cooky;

>$ gnatmake -gnatf -gnatwa cooky.adb
>gcc-3.2 -c -gnatf -gnatwa cooky.adb
>cooky.adb:1:09: warning: no entities of "Text_Io" are referenced
>cooky.adb:7:09: "Put_Lien" is undefined
>cooky.adb:7:09: possible misspelling of "Put_Line"
>gnatmake: "cooky.adb" compilation error

That's cool. I'm just thinking of what lengths you have to go to to
even find all case transpositions, 2-character transpositions, 1
character omissions or insertions. That would be enough to be useful I
guess.

Hats off to GNAT!



Fri, 26 Aug 2005 18:22:07 GMT  
 
 [ 13 post ] 

 Relevant Pages 

1. Still having WEIRD internal ERROR in Visual.net beta with C# : Parse Error

2. ADO error IDispatch error #3081 ,what mean ? help

3. My MFC app having errors on win2k

4. HELP I'm having compile errors.

5. Namespaces and Classes having same name causing compile error

6. ERROR: MIDL.exe after having installed Platform SDK July 2000

7. Calling csc.exe from command line and having it generate doc with no error checking

8. What is parse error means?

9. what's the error mean?

10. wat do these error messages mean

11. Whats mean the error C2177: constant too big?

 

 
Powered by phpBB® Forum Software