本人现在想做个Win32 DLL,但是用到CString时候,总会错误弹出提示“error C2065: 'CString' : undeclared identifier”,但是我在Win32 Console Application下却是可以使用CString的,请问是不是做Win32 DLL不能使用CString? 

解决方案 »

  1.   

    在创建Win32 DLL工程时选择支持MFC即可。
      

  2.   

    CString是MFC特有的吧
    如果非要用,就用2楼的方法吧
      

  3.   

    如果你的dll是光针对VC程序调用,那用CString没有问题,如果还提供给其他语言编写的程序使用,就不能用CString了。
    不过最好是字符串缓冲区char buffer[].外部调用事先分配好的缓冲区。
      

  4.   

    我的DLL是要为其他语言使用的,
    原来是使用
    int m_ia;
    CString m_stra;
    m_stra.Format("%d",m_ia);
    _bstr_t bstrSql = "Update tabBProccessData set AppearTimes = 1 where TagId = "+m_stra;
    可以使用bstrSql,但是现在不用CString,我怎么才能将int m_ia数据传到bstrSql中去?
      

  5.   

    可试试使用wsprintf将数值转为字符串。
      

  6.   

    关键问题是_bstr_t bstrSql = "Update tabBProccessData set AppearTimes = 1 where TagId = "+m_stra;这句话
    会弹出错误提示“error C2110: cannot add two pointers”,我就希望这句话能使用就好了
      

  7.   

    将语句分开就可以了:_bstr_t bstrSql = "Update tabBProccessData set AppearTimes = 1 where TagId = ";bstrSql += m_stra;
      

  8.   

    太感谢7楼 QueenieQ 你了!!!
    我花了1天都没有解决的问题,终于解决了,请问我可以加你为好友吗?