3
我不明白一個問題:使用枚舉
Types.hpp:
enum SomeEnum { one, two, three };
First.hpp:
#include "Types.hpp"
class First
{
public: void someFunc(SomeEnum type) { /* ... */ }
};
Second.hpp:
#include "Types.hpp"
#include "First.hpp"
class Second
{
public: void Foo()
{
First obj;
obj.someFunc(two); // two is from SomeEnum
}
};
禰錯誤:
no matching function for call to ‘First::someFunc(SomeEnum)’
note: candidate is: void First::someFunc(First::SomeEnum)
你是否缺少.cpp文件?從你的列表中我看不到'First :: someFunc'調用的實際實現。 – wheaties 2010-10-24 18:14:28
不可複製。什麼是'EnvironTypes'? – kennytm 2010-10-24 18:14:57
編譯器在做什麼? – 2010-10-24 18:15:05