-1

http://ms-iot.github.io/content/16x2LCD.htmから Intel Galileo でいくつかのサンプル コードを実行しようとしています。

基本的にLCDモジュールに文字を書き込むだけです。LiquidCrystal ライブラリは、異なるライブラリからの複合クラスのため、Visual Studio では機能しません。クラスPrintとオブジェクトprintが異なるクラスで使用され、複合されているため、基本的にコンパイルエラーC2653とその他のエラーが発生します。エラーを修正する方法を知っている人

    error C2011: 'Print' : 'class' type redefinition    
          class Print{
                  private:  int write_error;    
    error C2039: 'print' : is not a member of 'LiquidCrystal'
          lcd.print("Hello!");
    error C2504: 'Print' : base class undefined
          class LiquidCrystal : public Print {  public:
    error C2873: 'write' : symbol cannot be used in a using-declaration,
            using Print::write;
    error C2027: use of undefined type 'Print'
            using Print::write;
    error C2873: 'write' : symbol cannot be used in a using-declaration 
            using Print::write;

問題は、名前空間が認識されていないことと、LCD ディスプレイへの書き込みに Print を使用する LCD クラスでの Print.h の使用が多用されていることによるものだと思います。

Print.h が呼び出されるたびに再定義されないように、LCD クラスで Print の関数を呼び出すにはどうすればよいですか?

4

1 に答える 1

0

http://sixfortyfour.wordpress.com/2014/09/26/displaying-intel-galileo-ip-address-on-a-16x2-lcd/ 簡単な修正として、Print.h と Stream.h のファイルを変更しました。 {Galileo Project Folder}\packages\Microsoft.IoT.Galileo.Arduino.1.0.5\build\native\include にあります。Print.h については、次を追加しました。

#ifndef _PRINT_H
#define _PRINT_H

class Print
{
// Rest of print class
}

#endif

Stream.h については、次のように変更しました。

enter code hereclass Stream : public Print -> class Stream

github リポジトリを確認したところ、Print.h に変更が含まれています。Stream.h は引き続き Print ( https://github.com/ms-iot/galileo-sdk/tree/develop/source ) を継承しています。

RS、ENABLE、D0、D1、D2、D3 も変更して、netduino プロジェクトで使用した LCD 構成に一致させました。

于 2014-09-28T09:32:23.133 に答える