我建了一个win32 DLL
在一个文件中我用到了CString形的数据,编译老是提示我出错
#ifndef __PUBLICSOURCE__
#define __PUBLICSOURCE__#include "stdafx.h"/*
描述:常用公共函数类
*/
class Tpublicsource
{
public:
 CString bytetostr(BYTE value);
// int HexToBuf(char *buf,int len);
};#endif
--------------------Configuration: Dll_VC - Win32 Debug--------------------
Compiling...
publicsource.cpp
d:\xj_work_station\test\1203\002\dll_vc\publicsource.h(12) : error C2146: syntax error : missing ';' before identifier 'BYTE2Str'
d:\xj_work_station\test\1203\002\dll_vc\publicsource.h(12) : error C2501: 'CString' : missing storage-class or type specifiers
执行 cl.exe 时出错.
Creating browse info file...Dll_VC.dll - 1 error(s), 0 warning(s)

解决方案 »

  1.   

    我做了,但編译如下
    --------------------Configuration: Dll_VC - Win32 Debug--------------------
    Compiling...
    publicsource.cpp
    d:\program files\microsoft visual studio\vc98\mfc\include\afxv_w32.h(14) : fatal error C1189: #error :  WINDOWS.H already included.  MFC apps must not #include <windows.h>
    执行 cl.exe 时出错.
    Creating browse info file...
    BSCMAKE: error BK1506 : cannot open file '.\Debug\publicsource.sbr': No such file or directory
    执行 bscmake.exe 时出错.Dll_VC.dll - 1 error(s), 0 warning(s)
      

  2.   

    <windows.h>就不需要包含了
    rebuild all
      

  3.   

    我没有手工包含<windows.h>,要在那里去
      

  4.   

    #include <afx.h>
    加入了这个就可以用CString类型了
    cannot open file '.\Debug\publicsource.sbr': No such file or directory
    这个问题只需要Build->Rebuild All
      

  5.   

    MFC apps must not #include <windows.h>你在stdafx.h文件里面删除  windows.h 就可以了
      

  6.   

    我照着做了,可以编译如下--------------------Configuration: Dll_VC - Win32 Debug--------------------
    Linking...
    nafxcwd.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in Dll_VC.obj
    Debug/Dll_VC.dll : fatal error LNK1169: one or more multiply defined symbols found
    执行 link.exe 时出错.Dll_VC.dll - 1 error(s), 0 warning(s)