gcc error: instantiated from...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vartas
    New Member
    • Jul 2008
    • 3

    gcc error: instantiated from...

    Hi,
    i got the following gcc-error and hope you could help me to unterstand why:

    instantiated from 'const XWCPC* FILE_FM::LOCALE ::fct_format(co nst xs_t*, xs_t*, FILE_FM::FB*, T, XWCP*) [with T = long double]'

    [code=c]
    template<class T>
    const XWCPC *fct_format(XS_ CS ft, xs_t *buf, FB *o, T v, XWCP *r)
    { o->getFt(&ft);
    int l = LOCALE::xsPrint f1(buf, ft, v);
    ...
    return r;
    };[/code]
    Last edited by sicarie; Jul 2 '08, 02:02 PM. Reason: Code tags
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    Beats me. Nort enough code to see what's going on.

    I did take your code and make some asumptions and did not get any error:
    [code=cpp]
    typedef int XWCP;
    typedef const int XWCPC;
    typedef int XS_CS;
    typedef int xs_t;
    typedef int FB;
    template<class T>
    class LOCALE
    {
    public:
    int xsPrintf1(xs_t* buf, XS_CS ft, T v);
    };
    template<class T>
    int LOCALE<T>::xsPr intf1(xs_t* buf, XS_CS ft, T v)
    {
    return 0;
    }
    template<class T>
    const XWCPC *fct_format(XS_ CS ft, xs_t *buf, FB *o, T v, XWCP *r)
    { o->getFt(&ft);
    int l = LOCALE::xsPrint f1(buf, ft, v);
    ...
    return r;
    };

    int main()
    {

    LOCALE<long double> obj;
    int a = 10;
    int b = 20;
    long double c = 3.5;
    obj.xsPrintf1(& a,b,c);
    }
    [/code]

    Comment

    • vartas
      New Member
      • Jul 2008
      • 3

      #3
      Thank you, weaknessforcats . This has already helped to locate the fault, but I am still 'overextend' with it. Here the code for the method:
      Code:
      typedef wchar_t xs_ucs4_t;
      typedef xs_ucs4_t xsu_t;
      typedef xsu_t xs_t;
      #define XS_(t) (t)
      #define XS_CTC_(T) const T *const
      #define XS_CUC XS_CTC_(xsu_t)
      #define LOCALE_BUF_SIZE  255
      
      template<class T>
      static int xsPrintf1(xsu_t *b, XS_CUC f, T v)
      {
      	char bf[LOCALE_BUF_SIZE];
      	char bv[LOCALE_BUF_SIZE];
      
      	const xs_t *x = XS_(f);
      	char *y = bf;
      
      	for (int i = LOCALE_BUF_SIZE-1; i >= 0; i--)
      	{
      		if (!(*y++ = (char)(*x++)))
      			break;
      	}
      	*y = 0;
      
      	int r = snprintf(bv, LOCALE_BUF_SIZE,bf, v);
      
      	y = bv;
      
      	while (*b++ = (unsigned char)(*y++));
      
      	return r;
      }
      thank you in advance for your help readiness.

      Comment

      • vartas
        New Member
        • Jul 2008
        • 3

        #4
        Ok, thank you very much. Could it be a make-issue? In your code above, I received the following errors:
        'template <class T> class LOCALE' used without template
        parameters, line: int l = LOCALE: xsPrintf1 (buf, ft, v);
        make: *** [main.o] .

        Comment

        Working...