Sign In | Register Now About Bytes | Help | Site Map
Connecting Tech Pros Worldwide

gcc error: instantiated from...

Question posted by: vartas (Newbie) on July 2nd, 2008 11:24 AM
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(const xs_t*, xs_t*, FILE_FM::FB*, T, XWCP*) [with T = long double]'

Expand|Select|Wrap|Line Numbers
  1. template<class T>
  2. const XWCPC *fct_format(XS_CS ft, xs_t *buf, FB *o, T v, XWCP *r)
  3. {    o->getFt(&ft);
  4.     int l = LOCALE::xsPrintf1(buf, ft, v);
  5.         ...
  6.        return r;
  7. };
weaknessforcats's Avatar
weaknessforcats
Moderator
4,756 Posts
July 2nd, 2008
03:08 PM
#2

Re: gcc error: instantiated from...
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:
Expand|Select|Wrap|Line Numbers
  1. typedef int XWCP;
  2. typedef const int XWCPC;
  3. typedef int XS_CS;
  4. typedef int xs_t;
  5. typedef int FB;
  6. template<class T>
  7. class LOCALE
  8. {
  9. public:
  10.     int xsPrintf1(xs_t* buf, XS_CS ft, T v);
  11. };
  12. template<class T>
  13. int LOCALE<T>::xsPrintf1(xs_t* buf, XS_CS ft, T v)
  14. {
  15.     return 0;
  16. }
  17. template<class T>
  18. const XWCPC *fct_format(XS_CS ft, xs_t *buf, FB *o, T v, XWCP *r)
  19. {   o->getFt(&ft);
  20.     int l = LOCALE::xsPrintf1(buf, ft, v);
  21.         ...
  22.        return r;
  23. };
  24.  
  25. int main()
  26. {
  27.  
  28.    LOCALE<long double> obj;
  29.    int a = 10;
  30.    int b = 20;
  31.    long double c = 3.5;
  32.    obj.xsPrintf1(&a,b,c);
  33. }

Reply
vartas's Avatar
vartas
Newbie
3 Posts
July 3rd, 2008
08:15 AM
#3

Re: gcc error: instantiated from...
Thank you, weaknessforcats. This has already helped to locate the fault, but I am still 'overextend' with it. Here the code for the method:
Expand|Select|Wrap|Line Numbers
  1. typedef wchar_t xs_ucs4_t;
  2. typedef xs_ucs4_t xsu_t;
  3. typedef xsu_t xs_t;
  4. #define XS_(t) (t)
  5. #define XS_CTC_(T) const T *const
  6. #define XS_CUC XS_CTC_(xsu_t)
  7. #define LOCALE_BUF_SIZE  255
  8.  
  9. template<class T>
  10. static int xsPrintf1(xsu_t *b, XS_CUC f, T v)
  11. {
  12.     char bf[LOCALE_BUF_SIZE];
  13.     char bv[LOCALE_BUF_SIZE];
  14.  
  15.     const xs_t *x = XS_(f);
  16.     char *y = bf;
  17.  
  18.     for (int i = LOCALE_BUF_SIZE-1; i >= 0; i--)
  19.     {
  20.         if (!(*y++ = (char)(*x++)))
  21.             break;
  22.     }
  23.     *y = 0;
  24.  
  25.     int r = snprintf(bv, LOCALE_BUF_SIZE,bf, v);
  26.  
  27.     y = bv;
  28.  
  29.     while (*b++ = (unsigned char)(*y++));
  30.  
  31.     return r;
  32. }

thank you in advance for your help readiness.

Reply
vartas's Avatar
vartas
Newbie
3 Posts
July 3rd, 2008
09:53 AM
#4

Re: gcc error: instantiated from...
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] .

Reply
Reply
Not the answer you were looking for? Post your question . . .
189,088 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
Top C / C++ Forum Contributors