C++ unresolved external symbol

前端 未结 4 1559
说谎
说谎 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:43

    I think you're trying to compile with gcc, when you should be compiling with g++. See What is the difference between g++ and gcc? for more on this.

    You also need to add string CPractice::name; below your class definition.

提交回复
热议问题