iOS duplicate symbol 變數 in 類名 報錯

來源:互聯網
上載者:User

標籤:com   system   c語言   產生   錯誤資訊   locate   verify   variable   是什麼   

該錯誤資訊是我在一個.h檔案裡申明了公開變數,然後在其他類裡重複使用。

Build Settings ->No Common Blocks預設為YES,編譯器就報錯了,需要修改Build Settings裡的No Common Blocks為NO。

 

NO Common Blocks 是什嗎?

 官方的解釋是:

    In C, allocate even uninitialized global variables in the data section of the object file, rather than generating them as common blocks. This has the effect that if the same variable is declared (without extern ) in two different compilations, you will get an error when you link them. The only reason this might be useful is if you wish to verify that the program will work on other systems which always work this way.

    在C語言中,在目標檔案的資料區段分配甚至未初始化的全域變數,而不是產生它們作為公用塊。這樣做,如果同一個變數被聲明(沒有extern)放在兩個不同的彙編,你會當你將它們連結得到一個錯誤的影響。這可能是有用的唯一原因是,如果你想驗證程式將在其他系統上,它總是以這種方式工作工作。

iOS duplicate symbol 變數 in 類名 報錯

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.