C++ unresolved external symbol

前端 未结 4 1518
说谎
说谎 2021-01-12 21:04

Hi iam begginer at c++ i have class with static methods and i cant access them it throws me an error

    1>------ Build started: Project: CPractice, Confi         


        
4条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-12 21:33

    You only declared name in the class, static variables need to be defined like so outside of the class:

    string CPractice::name ="hello" ;
    

提交回复
热议问题