C++ vector issue - 'LNK2001: unresolved external symbol private: static…'

前端 未结 3 1053
眼角桃花
眼角桃花 2021-02-05 09:45

Before anyone calls me out for not looking at pre-existing questions, I have looked and realise that it is to do with declaration, but I still can\'t get it to work (might be so

3条回答
  •  太阳男子
    2021-02-05 10:05

    In your .cpp file, you need to add the definitions of the static variables:

    vector Manager::airports;
    vector Manager::flights;
    

    See Why are classes with static data members getting linker errors? from the C++ FAQ.

提交回复
热议问题