"undefined reference"linker error for static field w/ C++
I get the linker error
/tmp/ccHfwmmN.o(.text+0x12): In function `Test::Foo()': : undefined reference to `Test::signList' with Code:
class Test { Thanks in advance, Alek |
You only "declared" bar. Somewhere, you need to define (allocate space for) the actual variable "Test::bar".
|
Hi, both static member functions and data members must be defined somewhere.
Add this definition after the class. Code:
vector<string> Test::bar; Code:
class Test { |
Thanks a lot for your help. It works now,
|
Cool! That particular subtlety bit me the first time I played with static members, too!
|
Thanks!
I had that problem too, it works perfect now. Thank you!
|
All times are GMT -5. The time now is 05:58 AM. |