報錯:
定義了一個全局變量,編譯的時候報錯了:
warning: built-in function 'index' declared as non-function [-Wbuiltin-declaration-mismatch]
int index;
^~~~~
原因:
其實從警告的提示信息裏可以看出,“內建函數index被聲明爲非函數”,也就是說index是一個內建函數,查了一下,這確實是個函數。因此,修改一下變量的名字,就不會報錯了。
定義了一個全局變量,編譯的時候報錯了:
warning: built-in function 'index' declared as non-function [-Wbuiltin-declaration-mismatch]
int index;
^~~~~
其實從警告的提示信息裏可以看出,“內建函數index被聲明爲非函數”,也就是說index是一個內建函數,查了一下,這確實是個函數。因此,修改一下變量的名字,就不會報錯了。