[bigint] problems linking with the BigIntegerLibrary
Matt McCutchen <matt at mattmccutchen.net>
Tue Sep 23 16:38:29 PDT 2008
On Tue, 2008-09-23 at 18:03 -0500, Tomek wrote:
> I don't get any errors during compiling, but when the compiler tries
> to link, the following errors occur. I was just wondering if you had
> seen this before and if there was maybe some kind of easy fix (is
> there ever?)
>
> g++.exe encryption.o inputToAscii.o asciiToOutput.o BigInteger.o -o
> "encryption.exe" -L"C:/Dev-Cpp/lib"
>
> encryption.o(.text+0x187):encryption.cpp: undefined reference to
> `BigInteger::BigInteger(int)'
> encryption.o(.text+0x302):encryption.cpp: undefined reference to
> `operator<<(std::ostream&, BigInteger const&)'
> encryption.o(.text
> $_ZNK10BigIntegermlERKS_[BigInteger::operator*(BigInteger const&)
> const]+0x63):encryption.cpp: undefined reference to
> `BigInteger::multiply(BigInteger const&, BigInteger const&)'
> collect2: ld returned 1 exit status
You should include all the big-integer object files in the linking, not
just BigInteger.o:
g++.exe encryption.o inputToAscii.o asciiToOutput.o
BigIntegerAlgorithms.o BigInteger.o BigIntegerUtils.o
BigUnsignedInABase.o BigUnsigned.o -o "encryption.exe"
-L"C:/Dev-Cpp/lib"
This explains the second error: the << output operator is defined in
BigIntegerUtils.o. However, it doesn't explain the other errors, which
are for functions that should be present in BigInteger.o. You might try
running "nm --demangle BigInteger.o" to see whether they actually are
present.
Matt
More information about the bigint
mailing list