Menu

avoid compiled error i: expected constant exp

2012-06-28
2013-04-13
  • jianjun wang

    jianjun wang - 2012-06-28

    in sheetrec.cpp(694): error C2057: expected constant expression
    sheetrec.cpp(694): error C2466: cannot allocate an array of constant size 0
    I suggested changed it into:

                            len = strlen(strlabel);
    //wchar_t  wcs ;  //sheetrec.cpp(694): error C2057: expected constant expression
    wchar_t* wcs=new wchar_t;//changed to this line with new
    mbstowcs(wcs, strlabel, len+1);
                            len = wcslen(wcs);
                            for (int i = 0; i < len; i++) {
                                    u16 = wcs_;
                                    str16.push_back(u16);
                            }
    delete wcs; //please do not forgot to delte it
    wcs=NULL; // address write to NULL
                    }
    _

     
  • David Hoerl

    David Hoerl - 2012-06-28

    You must be using a very old release of xlslib. The code you reference above is not in the current release. Also, you don't mention your compiler - is it quite old? We never had any reported errors of the type you mention.  I suggest you pull the code from svn and build from it.

     
  • jianjun wang

    jianjun wang - 2012-06-30

    Sorry, for this inconvenience, it is some code added I from other place, it is for writing UTF8 code label, but I did not test it.
    you can get code from here (in Chinese)

    http://bbs.chinaunix.net/thread-1924761-1-1.html

     
  • David Hoerl

    David Hoerl - 2012-06-30

    So, if I got this right, you have a problem with your code that you want me to solve, not some problem with xlslib. I have done this for another person who needed a feature - my rate is $250/hour, half paid upfront. If you want to hire me then please let me know and we can discuss exactly what you want me to do.

     
  • jianjun wang

    jianjun wang - 2012-07-02

    Hi, DHoerl:
          The write unicode lable problem has been resolved by the guy from ChinaUnix, it is has code compiled error has been report by me to you too.
          I hope you can have a look at these code and considering possible to merge into xlslib.

     
  • David Hoerl

    David Hoerl - 2012-07-02

    Look, I understand that English is not your first language. But I have no idea what you think the problem is, and why the code at that URL is suppose to fix it. It does seem that you are using a very old xlslib release. In the past year xlslib was changed to support UTF-8 input strings, if that is the feature you are looking for.

     
  • jianjun wang

    jianjun wang - 2012-07-03

    I am using the latest version from SVN, but I did not notice you have provided a wide sting version for function lable, So that is why I mentioned that guy's method,

     
  • David Hoerl

    David Hoerl - 2012-07-03

    Just to be clear, the label feature has supported wide strings (wchar_t) for many years, and UTF-8 for the past year.

     
  • globe

    globe - 2013-02-02

    Label in chinese has supported correctly since 2011(verified in mac); the link to ChinaUnix is a fix in 2010 while not  support UTF-8 yet.

     

Log in to post a comment.