【解決方法】エラーは何を教えてくれますか?


エラーメッセージがわかりません。

私の C++ コードには何がありませんか?
解決策は何ですか?

C++
<pre>   //! [Register service]
    serviceInfo.registerService(localAdapter);
    //! [Register service]
    qDebug()<<"serviceInfo.device()"<<serviceInfo.device();
<pre>/media/nov25-1/MDI_BASE_RAID_5/BT_DEC24_/CCC_SOURCE/BLUETOOTH_LIBRARY/chatserver_BT_copy.cpp:240: error: calling 'device' with incomplete return type 'QBluetoothDeviceInfo'
chatserver_BT_copy.cpp:240:51: error: calling 'device' with incomplete return type 'QBluetoothDeviceInfo'
    qDebug()<<"serviceInfo.device()"<<serviceInfo.device();
                                      ~~~~~~~~~~~~^~~~~~~~
/home/nov25-1/Qt/Nov26/5.15.2/gcc_64/include/QtBluetooth/qbluetoothserviceinfo.h:112:26: note: 'device' declared here
    QBluetoothDeviceInfo device() const;
                         ^
/home/nov25-1/Qt/Nov26/5.15.2/gcc_64/include/QtBluetooth/qbluetoothserviceinfo.h:58:7: note: forward declaration of 'QBluetoothDeviceInfo'
class QBluetoothDeviceInfo;
      ^

私が試したこと:

エラーが発生しないため、何を試したらよいかわかりません。

解決策 1

エラーは、次の行にあることを示しています

C++
qDebug()<<"serviceInfo.device()"<<serviceInfo.device();

あなたのコードは型が不完全なオブジェクトを返しています。つまり、クラスの前方宣言しかありません。 QBluetoothDeviceInfo: 完全な宣言が欠落しています。
たとえば、次を参照してください。 IBM ドキュメント – 不完全なクラス宣言[^].

コメント

タイトルとURLをコピーしました