[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
ld returned 1 exit status
From: |
derrick_chi |
Subject: |
ld returned 1 exit status |
Date: |
Sun, 19 Aug 2007 20:45:48 -0700 |
User-agent: |
G2/1.0 |
I am using the g++ compiler to compile the program shown below,
and I am getting this error "ld returned 1 exit status"
can anyone help me with this error.
#include "stdio.h"
#include "iostream."
#include "math.h"
unsigned int GCD_PR(unsigned int REGa, unsigned int REGb);
main() {
unsigned int ARRAY[32];
unsigned int Loop_Control_V, Reg1, Reg2, GCD, new_value;
for ( int i = 0; i < 31; ++ i ) {
new_value = i + ( 3 * (4) );
if ( new_value % 2 != 0 ) {
new_value = new_value * 4;
}
else{
new_value = new_value * 10;
}
ARRAY[i] = new_value;
}
Loop_Control_V = 0;
while ( Loop_Control_V < 30 ) {
if ( ARRAY[Loop_Control_V] > ARRAY[Loop_Control_V +
1] ) {
Reg1 = ARRAY[Loop_Control_V];
Reg2 = ARRAY[Loop_Control_V + 1];
}
else {
Reg1 = ARRAY[Loop_Control_V + 1];
Reg2 = ARRAY[Loop_Control_V];
}
GCD = GCD_PR(Reg1,Reg2);
//cout << " The GCD of "<<Reg1<<" and "<<Reg2<<" is
"<<GCD<<endl;
Loop_Control_V = Loop_Control_V + 1;
}
}
unsigned int GCD_PR(unsigned int REGa, unsigned int REGb) {
unsigned int temp1, temp2, GCD;
temp1 = REGa;
temp2 = REGb;
while ( temp1 != temp2 ) {
if ( temp1 > temp2 ) {
temp1 = temp1 - temp2;
}
else {
temp2 = temp2 - temp1;
}
}
GCD = temp1;
return GCD;
}
- ld returned 1 exit status,
derrick_chi <=