[英]Calling constructor of a template base class from a template derived class
我正在将一些代码从Visual Studio移植到Mingw GCC。 这段代码在Visual Studio上运行良好,但是当我尝试在Mingw中构建它时,遇到以下问题。 代码如下
HeaderFile
template <MThread Thread>
class AFWork : public EffectFramework<Thread>
{
public:
AFWork(HINSTANCE hinst, HWND hWindow,
const std::wstring& stSharedDataPath,
const std::wstring& stGameDataPath,
const std::wstring& stExtendedGameDataPath,
int nScrWidth, int nScrHeight);
virtual ~AFWork(void);
...
...
};
上面引用的基类的另一个头文件是:
HeaderFile
template <MThread Thread>
class EffectFramework : public ktWin32Framework
{
public:
typedef boost::function<void (int window_no, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)> WindowProcedure;
EffectFramework<Thread>( std::wstring& name,
std::wstring& dataDirPrefix,
VSYNC vsync,
HINSTANCE hinst,
HINSTANCE hprevinst,
LPSTR args,
int mode,
IApplicationManager* appl_manager = NULL);
....
....
};
派生类的构造函数的实现
template <MThread Thread>
AFWork<Thread>::AFWork(HINSTANCE hinst,
HWND hWindow,
const std::wstring& stSharedDataPath,
const std::wstring& stGameDataPath,
const std::wstring& stExtendedDataPath,
int nScrWidth,
int nScrHeight)
: EffectFramework<Thread>::EffectFramework(wstring(L"ArtViewer"), wstring(L""), VSYNC::VSYNC_1, hinst, NULL, NULL, 0, NULL) <---ERROR
{
}
我得到的错误是这个
error: no matching function for call to 'T_Wrapper::EffectFramework<(T_Wrapper::T_Thread)0u>::EffectFramework(std::wstring, std::wstring, T_Wrapper::VSYNC, HINSTANCE__*&, int, int, int, int)'|
关于为何收到此错误以及如何解决该错误的任何建议?
看来, EffectFramework
的候选构造EffectFramework
将std::wstring&
作为第一个和第二个参数,但是您正在传递临时变量。 例如,如果您要传递全局变量,则它应该起作用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.