2015-06-09 48 views
0

我想編譯其他人寫的arduino的polargraph代碼。據我所知,代碼本身是正確的,並添加了運行它所需的庫後,我收到此錯誤消息。你如何在arduino代碼中做前向聲明?

polargraph_server_polarshield.ino:109:16: error: 'prog_uint32_t' does not name a type
In file included from /Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/avr/cores/arduino/Arduino.h:28:0, from /Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/avr/libraries/SPI/SPI.h:17, from polargraph_server_polarshield.ino:47:
util.ino: In function 'long unsigned int crc_update(long unsigned int, byte)':
util.ino:392:31: error: 'crc_table' was not declared in this scope
util.ino:394:31: error: 'crc_table' was not declared in this scope
Error compiling.

我聽說你需要建立一個向前聲明,因爲它使用兩個詞在其數據類型和官方的Arduino編譯器不處理那麼好。我該如何去做呢?

回答

1

該項目的回購自制作zip包後已更新。

該行現在讀:當Arduino的IDE 1.6來約,並打破了一堆新的東西

const uint32_t PROGMEM crc_table[16] = { 

https://github.com/euphy/polargraph_server_polarshield/blob/master/polargraph_server_polarshield.ino#L108

這一變化是必需的!

因爲我已經更新了代碼束包括:

  • crc_table定義修復
  • UTFT庫更新v2.81(對於同樣的原因 - Arduino的IDE 1.6兼容性)

https://github.com/euphy/polargraphcontroller/releases/tag/2015-07-15-21-25

0

這看起來像你在簡單的C編碼;在這種情況下,這是一個簡單的C正向聲明,例如:

struct b; 
+0

它會去哪裏? – LinkReincarnate

+0

@LinkReincarnate:只有您可以回答這個問題,這是您的前瞻性聲明。你需要它的地方! –

1

有兩個錯誤顯示您提供的內容。首先,由於某種原因,沒有包含在頭文件中的prog_uint32_t聲明。所以你可能需要添加:

typedef uint32_t PROGMEM prog_uint32_t; 

或者包含正確的頭文件,如果有其他東西丟失。

您必須發佈util.ino草圖的代碼以獲得關於第二個錯誤的幫助。