我有一个名为Video的类,定义如下:
class Video
{
public:
Video() { }
~Video()
{
}
unsigned int m_max_ad_duration;
unsigned int m_max_skippable_duration;
unsigned int m_start_delay;
unsigned short int m_inventory_type;
unsigned short int m_skippable_Request;
};
如果我在一个名为Video.h的新文件中有上述内容,那么构建工作正常,但是当我在包含许多类的现有文件中声明上述内容时,构建失败并出现错误,例如
../../include/CampaignCache.h:33:56: error: ‘Video’ was not declared in this scope
../../include/CampaignCache.h:33:62: error: template argument 1 is invalid
../../include/CampaignCache.h:33:62: error: template argument 2 is invalid
../../include/CampaignCache.h:33:64: error: template argument 2 is invalid
../../include/CampaignCache.h:33:64: error: template argument 5 is invalid
../../include/CampaignCache.h:33:89: error: invalid type in declaration before ‘;’ token
../../include/CampaignCache.h:97:51: error: ‘Video’ has not been declared
make[2]: *** [BaseOpenRTBBidRequest.o] Error 1
make[2]: Leaving directory `/home/asif/RTB3.0trunk/trunk/3.0/src/bidder/ssp/OpenRTB'
make[1]: *** [OpenRTB] Error 2
make[1]: Leaving directory `/home/asif/RTB3.0trunk/trunk/3.0/src/bidder'
make: *** [compile] Error 2
理想情况下,我希望带有子类的文件中的Video类,有人可以解释为什么导致构建错误而另一个没有?
答案 0 :(得分:0)
我只是简单地将视频类放在一个独立的文件中,所有文件都开始正常工作