2012-01-02 5 views
0

Arduinoメガをプログラミングする2560. そして私はtft LCDを購入しました。その上に。コンパイル中にエラーが発生しました: 'void *'から 'unsigned char *'への無効な変換

私はこのライブラリをダウンロードしましたが、エラーが発生しました。

 
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としてコンパイルされるべきだと思います。

EDIT:

私はいくつかのエラーを得たので、私はライン585に行ってきましたその後、私は私がCPPとして保存している必要があり、プログラムでは、私はicktoofayが

を述べたものを書かなければならないことが判明上記のように変更されました。

BYTE * rbuff = buff;

BYTE RBUFF =(unsigned char型)バフに

そして、私は "couldnt find resources"のエラーを取り除くために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の上の#include TFT_ARDUINO_MEGA.hを追加し、まだ運

答えて

1

はCファイルとしてコンパイルしないようにしようとしたが、

extern "C" { 
#include <pff.h> 
} 
+0

私はそこに、このライブラリフォルダをダウンロードしたときまあ、ご覧3つのその中のファイル:[メインである] tft_menu、[CPP]校正やビットマップ、それを使用するファイルは、このようなpff.hを含んで[cpp]ので、私は新しいarduinoプロジェクトを開始し、私は3つのタブを開いた:tft_menu、キャリブレーションとビットマップ。 – Melkon

+0

私は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 ' メインに追加すると、diffエラーが出ます。 リンク; http://www.nuelectronics.com/estore/index.php?main_page = product_info&cPath = 1&products_id = 31 @icktoofay – Melkon

+0

@Melkon:リンク先の変更方法はわかりませんが、リンクの問題のようです。あなたが '未定義の参照 'エラーを得るたびに、それはリンクの問題です。あなたが '無効な変換 '、'このスコープで宣言されていない 'などを取得すると、それはリンク段階にさえ達しませんでした。リンク問題からコンパイル問題に進むと、あなたは逆らっています。 – icktoofay

関連する問題