我有這個頭文件:無法弄清楚如何修復類型依賴
//region.hpp
#ifndef REGION_HPP
#define REGION_HPP
...
#include "spacepoint.hpp"
class Image;
//class SpacePoint;
class Region
{
Rectangle<SpacePoint> boundaries;
...
它給這個錯誤
error: ‘SpacePoint’ was not declared in this scope
當我取消class SpacePoint
我得到這個:
In instantiation of ‘class Rectangle<SpacePoint>’:
region.hpp:15:27: required from here
rectangle.hpp:19:7: error: ‘Rectangle<T>::start’ has incomplete type
我試圖用較小的測試程序重現問題,但我不能。
我不知道如何去解決這個問題。
做spacepoint。 hpp嘗試包含region.hpp? –
SpacePoint是否偶然在名稱空間中聲明? –
定義了「矩形」的位置? – Jaywalker