templates C++ with GCC

templates C++ with GCC

本文关键字:GCC with C++ templates      更新时间:2023-10-16

我正在尝试将c++ windows应用程序移植到Linux。我也有问题。我不知道如何正确地解释,但我会尽力的。

我有下一个代码:在头文件:

    template<typename bidtype,typename chartype>
class pst_appointment_impl :
    virtual public pst_appointment,
    public pst_message_impl<bidtype,chartype>
{
...
}

在cpp文件(有我的问题):

...
template pst_appointment_impl<DWORD, char>;
template pst_appointment_impl<DWORDLONG,wchar_t>;

我不知道,它到底是如何调用的,但VS2010编译得很好。但是,在linux中,GCC在最后两行给出错误"Syntax error"。

有什么办法解决这个问题吗?

======================================================

(版)

定义了所有的窗口类型。我在linux上使用Eclipse。当类型有问题时,它给出错误"cannot resolve name",但现在:"Syntax error"

您必须正确声明DWORDDWORDLONG并使用

template class pst_appointment_impl<DWORD, char>;
template class pst_appointment_impl<DWORDLONG, wchar_t>;