0
我有一个名为LibItem的抽象基类,以及两个名为Book和DVD的继承类。我为每个类创建了.h和.cpp文件。C++编译文件
我现在想做一些代码在主要使用这些文件。
目前,我只是'包括'我的主要代码顶部的.h文件。 这不起作用。
我需要在使用它们之前编译这些文件吗?如果是这样,我该怎么做?
UPDATE
这里是我的代码:
//---------------------------------------------------------------------------
#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
我可以请有一些帮助这些错误?
一般而言,是的,以及如何取决于您的编译器和/或建立系统。 – juanchopanza
告诉我们您使用的是哪一个构建系统或编译器 – fasked
我正在使用C++ Builder。我有的文件是LibItem.h,LibItem.cpp,Book,h,Book.cpp,DVD.h,DVD.cpp –