C++ Program reports symbol(s) not found error
<p>Hi I have been writing (and learning) C++ and I write all my code correctly in the program (or so I think). I get this error:</p>

<pre><code> "rands(int)", referenced from:
      _main in ccgc4zY9.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
</code></pre>

<p>My code is this:</p>

<pre><code>#include&lt;iostream&gt;
#include&lt;stdlib.h&gt;
#include&lt;time.h&gt;
#include&lt;cmath&gt;

using namespace std;

int rands(int n);
int hits[10];

int main ()  {
    int n;
    int i;
    int r;
    srand(time(NULL));

    cout&lt;&lt;"enter a number of trials to run"&lt;&lt;endl;
    cin&gt;&gt;n;

    for (i=1; i&lt;=n; i++) {
        r=rands(10);
        hits[r]++;
    }

    for (i=0; i&lt;10; i++) {
        cout&lt;&lt;i&lt;&lt;":"&lt;&lt;hits[i]&lt;&lt;"&lt;Accuracy";
        cout&lt;&lt;static_cast&lt;double&gt;(hits[i])/(n/10)&lt;&lt;endl;
    }

    return 0;
}

int randns(int n) {
    return rand()%n;
}
</code></pre>

<p>Any help is appreciated!</p>
