0
編程一個Arduino兆2560. 我買了一個TFT液晶顯示器,爲此我想用SD卡,這樣我就可以把我的照片在上面。編譯時出錯:從'void *'無效轉換爲'無符號字符*'
我下載了這個庫,但它給了我錯誤。
C:\Arduino\libraries\pff\pff.cpp: In function 'FRESULT pf_read(void*, short unsigned int, short unsigned int*)': C:\Arduino\libraries\pff\pff.cpp:585: error: invalid conversion from 'void*' to 'unsigned char*'
的問題是海事組織在這裏:
pff.cpp:
FRESULT pf_read (
void* buff, /* Pointer to the read buffer (NULL:Forward data to the stream)*/
WORD btr, /* Number of bytes to read */
WORD* br /* Pointer to number of bytes read */
)
pff.h:
FRESULT pf_read (void*, WORD, WORD*); /* Read data from the open file */
當我使它成爲一個.c文件,它給我更多的錯誤,像這樣:
tft_menu.cpp.o: In function `open_root_dir()': C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:594: undefined reference to `pf_opendir(_DIR_*, char const*)' tft_menu.cpp.o: In function `mount_sd()': C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:583: undefined reference to `disk_initialize()' C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:585: undefined reference to `pf_mount(_FATFS_*)' tft_menu.cpp.o: In function `bitmap_show(char*)': C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:472: undefined reference to `pf_open(char const*)' C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:476: undefined reference to `pf_read(void*, unsigned short, unsigned short*)' C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:518: undefined reference to `pf_read(void*, unsigned short, unsigned short*)' tft_menu.cpp.o: In function `show_bitmap()': C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:603: undefined reference to `pf_readdir(_DIR_*, _FILINFO_*)'
所以我認爲它應該被編譯爲cpp。
編輯:
我發現我必須拯救被作爲CPP並在程序中我寫什麼icktoofay指出
後,我得到了一些錯誤,所以我去了線585 ,如上所述並且改變了
BYTE * rbuff = buff;
成
BYTE rbuff =(無符號字符)淺黃色;
我發現我不得不添加mcc.h來擺脫「找不到資源」的錯誤。
而現在即時得到這些錯誤:
C:\libraries\mmc/mmc.h: In function 'void init_spi()':
C:\libraries\mmc/mmc.h:21: error: 'PORTL' was not declared in this scope
C:\libraries\mmc/mmc.h:21: error: 'PORTL0' was not declared in this scope
C:\libraries\mmc/mmc.h:22: error: 'PORTB' was not declared in this scope
C:\libraries\mmc/mmc.h:22: error: 'PORTB2' was not declared in this scope
C:\libraries\mmc/mmc.h:22: error: 'PORTB1' was not declared in this scope
C:\libraries\mmc/mmc.h:23: error: 'DDRB' was not declared in this scope
C:\libraries\mmc/mmc.h:23: error: 'PORTB0' was not declared in this scope
C:\libraries\mmc/mmc.h:25: error: 'DDRL' was not declared in this scope
C:\libraries\mmc/mmc.h:27: error: 'SPCR' was not declared in this scope
C:\libraries\mmc/mmc.h:27: error: 'SPE' was not declared in this scope
C:\libraries\mmc/mmc.h:27: error: 'MSTR' was not declared in this scope
C:\libraries\mmc/mmc.h:28: error: 'SPSR' was not declared in this scope
C:\libraries\mmc/mmc.h:28: error: 'SPI2X' was not declared in this scope
香港專業教育學院試圖在mcc.h的頂部,仍然沒有運氣添加#TFT_ARDUINO_MEGA.h
遠遠看見,當我下載了這個庫文件夾,那裏有三個文件是:tft_menu [其中主要是],校準[CPP],和位圖[cpp],於是我開始了一個新的arduino項目,並打開了3個標籤:tft_menu,校準和位圖。 – Melkon 2012-01-02 12:37:31
當我打開bitmap.cpp,它已經表示,在頂部:爲extern 「C」{ 的#include 的#include } 但後來我得到這樣的錯誤:tft_menu.cpp.o:在功能'mount_sd ()': C:\ tft_menu.cpp:587:未定義引用'disk_initialize' pff \ pff.co:在函數'get_fat'中: C:\ libraries \ pff/pff.c:84:未定義的引用'disk_readp' 當我把它添加到主我得到差異錯誤。 鏈接; http://www.nuelectronics.com/estore/index.php?main_page = product_info&cPath = 1&products_id = 31 @icktoofay –
Melkon
2012-01-02 12:49:08
@Melkon:對不起,我不知道如何修改鏈接,但看起來像是一個鏈接問題。每當你遇到'undefined reference'錯誤,這都是一個鏈接問題。當你得到「無效轉換」,「未在此範圍內聲明」等時,它甚至沒有進入鏈接階段。當你從鏈接問題轉到編譯問題時,你有點後退。 – icktoofay 2012-01-02 21:38:46