我試圖創建在C++一個簡單的類,但我不斷收到編譯錯誤:類函數(Arduino的)的參數不編譯
main:2: error: variable or field 'doSomething' declared void
main:2: error: 'person' was not declared in this scope
主:
class person {
public:
int a;
};
void doSomething(person joe) {
return;
}
主()和東西會在這裏,但即使我包含main(){},錯誤仍然會發生。我也嘗試添加2右括號喬之後,但隨後即創建錯誤:
main: In function 'void doSomething(person (*)())':
main:8: error: request for member 'a' in 'joe', which is of non-class type 'person (*)()'
任何幫助是極大的讚賞。 (我希望這不是我真的很愚蠢,因爲我一直在研究幾個小時)。
編輯:我發現這是一個Arduino特定的錯誤。 This post解答它。
你的代碼中還有一個名爲'person()'的函數嗎? –
你的代碼編譯正確,所以一定有其他東西http://ideone.com/QpdPka –
不,我沒有在這段代碼中的任何其他功能。這是我唯一擁有的東西。 –