我做一个dll代码如下]#include <windows.h>
#include "edrlib.h"
int WINAPI DllMain (HINSTANCE hInstance, DWORD fdwReason, PVOID pvReserved)
{
     return TRUE ;
}EXPORT BOOL CALLBACK EdrCenterTextA (HDC hdc, PRECT prc, PCSTR pString)
{
     int  iLength ;
     SIZE size ;     iLength = lstrlenA (pString) ;     GetTextExtentPoint32A (hdc, pString, iLength, &size) ;     return TextOutA (hdc, (prc->right - prc->left - size.cx) / 2,
                           (prc->bottom - prc->top - size.cy) / 2,
                      pString, iLength) ;
}EXPORT BOOL CALLBACK EdrCenterTextW (HDC hdc, PRECT prc, PCWSTR pString)
{
     int  iLength ;
     SIZE size ;     iLength = lstrlenW (pString) ;     GetTextExtentPoint32W (hdc, pString, iLength, &size) ;     return TextOutW (hdc, (prc->right - prc->left - size.cx) / 2,
                           (prc->bottom - prc->top - size.cy) / 2,
                      pString, iLength) ;
}
/*----------------------
   EDRLIB.H header file
  ----------------------*/#define cplusplus 5//为什么这名有错呀
#ifdef __cplusplus
#define EXPORT extern "C" __declspec (dllexport)
#else#define EXPORT __declspec (dllexport)
#endifEXPORT BOOL CALLBACK EdrCenterTextA (HDC, PRECT, PCSTR) ;
EXPORT BOOL CALLBACK EdrCenterTextW (HDC, PRECT, PCWSTR) ;#ifdef UNICODE
#define EdrCenterText EdrCenterTextW
#else
#define EdrCenterText EdrCenterTextA
#endif
不知为什么定义#define cplusplus 5,就会有错呀

解决方案 »

  1.   

    这是一个dll的全部原码各位大侠帮小弟看看,的确有错,各位大侠可以式式
      

  2.   

    把define注释掉,看还有没有错误,有的话,是什么错误
      

  3.   

    define 对呀,这样就没错了,可是为什么呀
      

  4.   

    cplusplus好像是系统自己的预编译选项吧。
      

  5.   

    头文件的问题
    今天我才预到此问题
    后来将了新的Windows SDK 开发包就好了。