typedef unsigned short WCHAR;
typedef unsigned short UINT16;
typedef unsigned char UINT8;WCHAR w_text[100];
UINT16 length;
UINT8 num;
 xxx ( p1, p2, p3, p4, p5, p6, p7, p8
     w_text + (length * num)); // 作为一个函数的参数,指针指向unicode字符串其中一个起点的编译,visual studio给出错误提示:error C2664: cannot convert prameter 9 from 'WCHAR *' to 'UINT16 *

解决方案 »

  1.   

    VC10没有发现这个问题,通过的!
    #include <iostream>
    using namespace std;typedef unsigned short WCHAR_t;
    typedef unsigned short UINT_t;void test(UINT_t u, WCHAR_t w)
    {
        u;
        w;
    }int main()
    {
        UINT_t u = 99;
        test(u, u);
        return 0;
    }
      

  2.   

    MinGW 4.4也通过上面的代码。另,楼主不要定义成一些常见的类型。
    因为可能已经typedef掉了。typedef unsigned short WCHAR; 
    typedef unsigned short UINT16; 
    typedef unsigned char UINT8; 这些类型,可能在系统头文件中已经定义。