使用Visual C++ 2010我有類似下面的代碼:C++編譯器告訴我一個類型無法識別
文件A.hpp:
...
#include "R.hpp"
...
class A; // forward declaration because the APtr_t is used inside the A class too.
typedef boost::shared_ptr<A> APtr_t;
...
class A {
...
void some_method() {
...
R::get()->mehod(); // singleton ;)
...
}
...
};
文件R.hpp:
...
#include "A.hpp"
...
class R {
...
APtr_t method();
...
};
Visual C++編輯器說它沒問題(沒有標記錯誤),但編譯項目時,它充當APtr_t未定義。 它顯示了這樣的錯誤:
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
的事情是,這個問題只在R.hpp文件正在發生的事情,我想......
你有什麼想法? 這很令人困惑: -/
在此先感謝。
我假定線`APtr_t()的方法:用分號,而不是一個完整的結腸`結束? – templatetypedef 2011-02-01 22:16:24
你需要發佈更多的代碼 - 最好是整個標題。 – Puppy 2011-02-01 22:21:54