2015-03-24 174 views
0

我将一些代码从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)'| 

为什么我得到这个错误以及如何解决它的任何建议?

回答

1

似乎,来自EffectFramework的候选构造函数具有std::wstring&作为第一个和第二个参数,但是您正在传递临时变量。例如,如果你要传递全局变量,那么它应该工作。

+0

真棒捕捉 – MistyD 2015-03-24 22:31:28

+0

很高兴这有帮助 – tonso 2015-03-24 22:31:58

相关问题