比如说是
dibdoc.cpp文件中包含了encrypt.h
encrypt.cpp文件中包含了dibdoc.h
然后就提示错误信息rror LNK2005: "struct __unnamed wkbarInitDIBData" (?wkbarInitDIBData@@3U__unnamed@@A) already defined in dibdoc.obj
.\Debug/diblook.exe : fatal error LNK1169: one or more multiply defined symbols found我把encrypt.cpp 和encrypt.h都贴出来的,便于各位分析问题。// Encrypt.cpp: implementation of the CEncrypt class.
//
//////////////////////////////////////////////////////////////////////#include "stdafx.h"
#include "diblook.h"
#include "Encrypt.h"
#include "dibdoc.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////CEncrypt::CEncrypt()
{}CEncrypt::~CEncrypt()
{}
//======================= Add the AXAN technology ========================///***************************************************************************** ---- Area Descriptions for Encryption/Decryption of Code and Data ----------*****************************************************************************/// NOTE: See the manual for a description of the principles behind AXAN.
// A detailed explanation of the WKBAREA structure and of all the flags
// can be found in the online help file.#if defined(_MSC_VER)
  // disable warning C4200
  #pragma warning(push)
  #pragma warning(disable: 4200)
#endif
WKB_BEGIN_AXAN_CODEFN_TABLE(Func1)
WKB_AXAN_CODE((WkbAxanCodeFn)CDibDoc::InitDIBData,
CB_AREA_NUMBER, &wkbarInitDIBData.wkbar, NULL, WKBAXAN_SC_FCUC)WKB_END_AXAN_CODE_TABLE()
// "Standard" is the name of the WKBAREAHEAD. You need call WKCRYPT.EXE
// with the option /CH:_wkbarhStandard to use this table. The prefix "_"
// is added by the compiler, the prefix "wkbarh" is added by the
// WKB_BEGIN_AXAN_HEAD macro. This is done to get a unique variable
// name.
WKB_BEGIN_AXAN_HEAD(MyDemo, "WKAXANH", 0)
WKB_AXAN_CODE_TABLE(Func1)
WKB_END_AXAN_HEAD()#if defined(_MSC_VER)
  // restore original setting of warning C4200
  #pragma warning(pop)
#endif//======================= End of Add the AXAN technology ===================//BOOL CEncrypt::DecryptProgram(WIBUKEYDATA *pwkdata)
{ BOOL fValid;

// we can decrypt only once
if (!pwkdata->fIsDecrypted) 
{
if (!WkDmObject.CheckBox(pwkdata)) 
{
// WIBU-BOX entry not found -> no encryption possible
return FALSE;
} // if

// decrypt OnAdd function
// select entry, decrypt area, unselect entry
fValid = WkbCrypt2(
pwkdata->hwkbe,     // handle to opened entry
WKB_STDCTRL,        // standard flags
(CWkbAxanCodePtr)(WkbAxanCodeFn)CDibDoc::InitDIBData, // pointer to the function (= start of decrypt area)
&wkbarInitDIBData.wkbar,  // control structure (filled by WKCRYPT)
CB_AREA_NUMBER,      // number of bytes to decrypt
NULL                // we do not need the return value
);
if (!fValid) 
{
// any error
WkDmObject.PrintWkError("WkbCrypt2");
return FALSE;
} // if

// we can decrypt only once, set flag to remember
pwkdata->fIsDecrypted = TRUE;
} // if

// decryption successfully finished return TRUE;}// Encrypt.h: interface for the CEncrypt class.
//
//////////////////////////////////////////////////////////////////////#if !defined(AFX_ENCRYPT_H__B56D4514_0D15_48F3_8B4C_4D80A56820CE__INCLUDED_)
#define AFX_ENCRYPT_H__B56D4514_0D15_48F3_8B4C_4D80A56820CE__INCLUDED_#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "NonStaticTest.h"
#include "wkaxanenhanced.h"#define CB_AREA_NUMBER 50
class CEncrypt : public CObject  
{
public:
NonStaticTest WkDmObject;
BOOL DecryptProgram(WIBUKEYDATA *pwkdata);
CEncrypt();
virtual ~CEncrypt();
public:
}; // ==========================================
// area 1: first 100 bytes of OnButtonCalc()
// ==========================================struct {
WKBSELECT wkbsel;
WKBAREA wkbar;
BYTE abGapMap[WKB_GET_MAP_SIZE(CB_AREA_NUMBER)];
} wkbarInitDIBData = {
{
WKB_SEL_FEAL32, // algorithm to use
0, // ulCacheId filled by WKCRYPT
0, // CRC filled by WKCRYPT
12, // length of initialization data
{'W','I','B','U','-','S','Y','S','T','E','M','S'}
},
{// WKBAREA structure (prepared for AXAN)
    // (WKB_AREA_CHKCRC set by WKCRYPT)
    WKB_AREA_CODE|WKB_AREA_SELECT,
    WKB_SEL_SYMFEAL,
    WKB_SC_EXPDATE, // Selection Code filled by WKCRYPT
    0, // CRC filled by WKCRYPT
    0, // reserved
    wkbarInitDIBData.abGapMap,
    &(wkbarInitDIBData.wkbsel) // none because direct encryption
  }
};
#endif // !defined(AFX_ENCRYPT_H__B56D4514_0D15_48F3_8B4C_4D80A56820CE__INCLUDED_)
然后在diblook.cpp中什么也没做,就是把encrypt.h包含进去了,就提示出错。。如果觉得可以在线解答的话,可以Q我:350695956