Where do you declare a constant in Objective-C?

后端 未结 4 1634
故里飘歌
故里飘歌 2020-12-07 18:54

I declared a constant in a header file const double EARTH_RADIUS=6353; that is imported to various other headers and I got a linker error.

L         


        
4条回答
  •  难免孤独
    2020-12-07 19:14

    Declare it in a source file and have external linkage to it( using extern keyword ) so as to use in all other source files.

提交回复
热议问题