#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    4
    Rep Power
    0

    Question linking/compiling error? class templates


    after compiling, I get the following errors:

    $g++ -Wall -ansi Number.C BigInt.C main1_aux.C main.C
    main.C: In function `int main(int, char**)':
    main.C:33: no matching function for call to `Number::Number()'
    Number.H:11: candidates are: Number::Number(const Number&)
    Number.C:43: Number::Number(const std::string&) [with T =
    BigInt]
    Number.C:14: Number::Number(int) [with T = BigInt]
    main.C:33: no matching function for call to `Number::Number()'
    Number.H:11: candidates are: Number::Number(const Number&)
    Number.C:43: Number::Number(const std::string&) [with T =
    BigInt]
    Number.C:14: Number::Number(int) [with T = BigInt]

    -----------------------

    It gives me candidates, but I have

    BigInt::BigInt(int value = 0)

    templated function
    Number::Number(int value = 0)

    and

    BigInt::BigInt(const string & s)

    templated function
    Number::Number(const string & s)

    already

    So, I'm confused as to what exactly the problem is.
    Last edited by missrikku; September 23rd, 2003 at 06:25 PM.
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,607
    Rep Power
    4247
    Please post your line 33 from main.C here. I'm guessing you have some variable declared like this:
    Number foo;

    instead of:
    Number foo(intvalue);
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    4
    Rep Power
    0
    ahh yes, you're right..

    well, i've since changed a few things and am now getting:


    main.C:31: undefined reference to `Number<BigInt>::Number [in-charge]()'

    main.C:31: undefined reference to `Number<BigInt>::~Number [in-charge]()'

    when in main i was doing:

    Number<BigInt> n1, n2;

    ---

    i have no idea what that means.

IMN logo majestic logo threadwatch logo seochat tools logo