Program won't compile..
Sep 16, 2013 at 3:04am UTC
Im getting a linker error:
Error 2 error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
Error 3 error LNK1120: 1 unresolved externals
How can I fix this? Here's my code..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#ifndef BIGINT_H
#define BIGINT_H
const int MAXINT = 500;
class bigint{
public :
bigint();
bigint(int );
bigint(char []);
void output (std::ostream& out);
bool compare(const bigint &rhs);
private :
int value[MAXINT];
};
#endif
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
#include <iostream>
#include "bigint.h"
bigint::bigint(){
for (int i=0; i <= MAXINT; i++)
value[i] = 0;
}
bigint::bigint(int digit){
int numdigits = log10((double )digit) + 1;
for (int i=numdigits-1; i >= 0; i--)
{
value[i] = digit%10;
digit /= 10;
}
}
bigint::bigint(char *number){
for (int i=0; i <= MAXINT; i++){
number[i] =- '0' ;
number[i] = value[i];
}
}
void bigint::output(std::ostream& o){
for (int i=0; i <= MAXINT; i++)
std::cout << value [i];
}
bool bigint::compare(const bigint &rhs){
bool comp;
for (int i=0; i <= MAXINT; i++){
if (value[i] == rhs.value[i])
comp = true ;
}
return comp;
}
Sep 16, 2013 at 4:16am UTC
You are missing a main() function.
Why were you reported??
Sep 16, 2013 at 4:27am UTC
@Superdude, check the forum, in the last 12hrs --how many posts(of the same type) has he posted? Over 5, I could count! Same thing over and over and over
Sep 16, 2013 at 4:28am UTC
Yeah I figured that out after I posted it but thanks! And i have no idea I didnt even know i was!!
Topic archived. No new replies allowed.