[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Linker can't find constants
From: |
Thomas Maeder |
Subject: |
Re: Linker can't find constants |
Date: |
Wed, 01 Jul 2009 09:04:25 +0200 |
User-agent: |
Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.22 (linux) |
Cary <caryj@juno.com> writes:
> The following code compiles, but the linker complains of an undefined
> reference. If I comment out the line with *xx* it will link. Is this
> a known and/or fixed bug in later versions of gcc?
No. It's a bug in your program.
> SLES 10.2
> gcc --version gcc (GCC) 4.1.2 20070115 (SUSE Linux)
>
> replace.cpp:
> #include <algorithm>
> #include <vector>
> class A
> {
> private:
> const static int k1 = 1;
This just declares k1. It does not define it.
> std::vector<int> mv;
> public:
> A(int p);
> };
Add
int const A::k1;
to define k1.
- Re: Linker can't find constants,
Thomas Maeder <=