0

LibItemという抽象基本クラスと、BookとDVDという2つの継承されたクラスがあります。これらのクラスごとに.hファイルと.cppファイルを作成しました。

私は今、これらのファイルを使用するためにメインでいくつかのコードを実行したいと思っています。

現在、メインコードの先頭に.hファイルを含めています。これは機能していません。

これらのファイルを使用する前にコンパイルする必要がありますか?もしそうなら、どうすればこれを行うことができますか?

アップデート

これが私のコードです:

//---------------------------------------------------------------------------

#ifndef BookH
#define BookH

class Book : public LibItem
{
public:
    Book(const std::string&, const std::string&, const std::string&, const std::string&, const std::string&, const std::string&, const std::string&);
    void setISBN(const std::string&);
    std::string getISBN();
    void PrintDetails();

private:
    Book();
    std::string ISBN;

};

//---------------------------------------------------------------------------
#endif

次のエラーが発生します。

[BCC32 Error] Book.h(7): E2303 Type name expected
[BCC32 Error] Book.h(9): E2090 Qualifier 'std' is not a class or namespace name
[BCC32 Error] Book.h(9): E2293 ) expected
[BCC32 Error] Book.h(10): E2090 Qualifier 'std' is not a class or namespace name

これらのエラーについてサポートをお願いできますか?

4

1 に答える 1

1

メインファイルで使用する宣言を含むall.hファイルを含める必要があります。また、.hファイルはコンパイル単位ではないため、すべての.cppファイルをproject / makefile/etcに追加してコンパイルする必要があります。

于 2012-08-30T06:15:13.327 に答える