1>正在链接...
1>LINK : warning LNK4098: 默认库“LIBCMT”与其他库的使用冲突;请使用 /NODEFAULTLIB:library
1>MainFrm.obj : error LNK2001: 无法解析的外部符号 "public: static struct CRuntimeClass const TTabWnd::classTTabWnd" (?classTTabWnd@TTabWnd@@2UCRuntimeClass@@B)
1>Debug\TestMecLab.exe : fatal error LNK1120: 1 个无法解析的外部命令
1>生成日志保存在“file://f:\game\a\TestMecLab\Debug\BuildLog.htm”
1>TestMecLab - 2 个错误,1 个警告
--------------------------------------------------------------------------------------
在程序中的头文件中有如下类信息class AFX_EXT_CLASS TTabWnd : public CWnd {
DECLARE_DYNCREATE(TTabWnd)public:
enum TTabPos { TP_TOP, TP_BOTTOM };protected:
CBrush m_BrushBlack, m_BrushLGray;
CPen m_PenWhite, m_PenWhite2, m_PenBlack, m_PenLGray, m_PenDGray, m_PenDGray2;
CFont m_Font;protected:
int m_nSelectedTab;
BOOL m_bLockFlag;
TTabItemList m_TabList;
TTabPos m_nTabPos;private:
TTabItem *findTabItem(int nIndex);protected:
void createFont();
int drawTabTop(CDC *pDC, int x, CRect& client, TTabItem *pItem);
int drawTabBottom(CDC *pDC, int x, CRect& client, TTabItem *pItem);
int drawSelTabTop(CDC *pDC, int x, CRect& client, TTabItem *pItem);
int drawSelTabBottom(CDC *pDC, int x, CRect& client, TTabItem *pItem);
void drawClient(CDC *pDc, CRect& rect);
void invalidateTabArea(void);
TTabItem *addTab(CWnd *pWnd, LPCTSTR szLabel);
BOOL updateFrame(CFrameWnd *pFrame, CWnd *pWnd);protected:
// Following functions are protected since tab window cannot be created outside
// of the visual framework. Otherwise, we have memory leaks.
// Create a tab window
virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName,
DWORD dwStyle, const RECT& rect, CWnd* pParentWnd,
UINT nID=AFX_IDW_PANE_FIRST, CCreateContext *pContext = NULL);
// Resize tabs
virtual void ResizeTab(int cx = -1, int cy = -1);
// Create pane
virtual TTabItem *CreatePane(LPCTSTR lpszLabel, CRuntimeClass *pViewClass,
CCreateContext *pContext);
// Create splitter
virtual TTabItem *CreatePane(LPCTSTR lpszLabel, int nRows, int nCols,
CWnd *pWnd, UINT nID = AFX_IDW_PANE_FIRST);public:
TTabWnd();
virtual ~TTabWnd(); int GetTabLength(void);
int GetTabCount(void);
CWnd *GetTabWnd(int nIndex);
CString GetTabLabel(int nIndex);
void SetTabLabel(int nIndex, LPCTSTR szLabel); int GetTabIndex(void);
int GetTabIndex(CWnd *pWnd); void Enable(int nIndex, BOOL bEnable);
void EnableTab(int nIndex, BOOL bEnable);
void ShowTab(int nIndex, BOOL bShow);
BOOL IsTabEnabled(int nIndex);
BOOL IsTabVisible(int nIndex);
void SetFont(CFont *pFont);
void SetTabPos(TTabPos nTabPos); virtual int HitTest(int x, int y);
virtual int HitTest(CPoint& point); // Change active pane
virtual BOOL SetActivePane(int nIndex, BOOL bActivate = TRUE); // Em_ptSecondPos functions (implement in derived classes)
virtual BOOL CanSetActivePane(CWnd *pOldPane, CWnd *pNewPane);
virtual void OnSetActivePane(CWnd *pOldPane, CWnd *pNewPane);
protected:
//{{AFX_MSG(TTabWnd)
afx_msg LRESULT OnSizeParent(WPARAM, LPARAM lParam);
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
afx_msg void OnPaint();
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnDestroy();
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
//}}AFX_MSG
DECLARE_MESSAGE_MAP() friend class TVisualFramework;
};
1>LINK : warning LNK4098: 默认库“LIBCMT”与其他库的使用冲突;请使用 /NODEFAULTLIB:library
1>MainFrm.obj : error LNK2001: 无法解析的外部符号 "public: static struct CRuntimeClass const TTabWnd::classTTabWnd" (?classTTabWnd@TTabWnd@@2UCRuntimeClass@@B)
1>Debug\TestMecLab.exe : fatal error LNK1120: 1 个无法解析的外部命令
1>生成日志保存在“file://f:\game\a\TestMecLab\Debug\BuildLog.htm”
1>TestMecLab - 2 个错误,1 个警告
--------------------------------------------------------------------------------------
在程序中的头文件中有如下类信息class AFX_EXT_CLASS TTabWnd : public CWnd {
DECLARE_DYNCREATE(TTabWnd)public:
enum TTabPos { TP_TOP, TP_BOTTOM };protected:
CBrush m_BrushBlack, m_BrushLGray;
CPen m_PenWhite, m_PenWhite2, m_PenBlack, m_PenLGray, m_PenDGray, m_PenDGray2;
CFont m_Font;protected:
int m_nSelectedTab;
BOOL m_bLockFlag;
TTabItemList m_TabList;
TTabPos m_nTabPos;private:
TTabItem *findTabItem(int nIndex);protected:
void createFont();
int drawTabTop(CDC *pDC, int x, CRect& client, TTabItem *pItem);
int drawTabBottom(CDC *pDC, int x, CRect& client, TTabItem *pItem);
int drawSelTabTop(CDC *pDC, int x, CRect& client, TTabItem *pItem);
int drawSelTabBottom(CDC *pDC, int x, CRect& client, TTabItem *pItem);
void drawClient(CDC *pDc, CRect& rect);
void invalidateTabArea(void);
TTabItem *addTab(CWnd *pWnd, LPCTSTR szLabel);
BOOL updateFrame(CFrameWnd *pFrame, CWnd *pWnd);protected:
// Following functions are protected since tab window cannot be created outside
// of the visual framework. Otherwise, we have memory leaks.
// Create a tab window
virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName,
DWORD dwStyle, const RECT& rect, CWnd* pParentWnd,
UINT nID=AFX_IDW_PANE_FIRST, CCreateContext *pContext = NULL);
// Resize tabs
virtual void ResizeTab(int cx = -1, int cy = -1);
// Create pane
virtual TTabItem *CreatePane(LPCTSTR lpszLabel, CRuntimeClass *pViewClass,
CCreateContext *pContext);
// Create splitter
virtual TTabItem *CreatePane(LPCTSTR lpszLabel, int nRows, int nCols,
CWnd *pWnd, UINT nID = AFX_IDW_PANE_FIRST);public:
TTabWnd();
virtual ~TTabWnd(); int GetTabLength(void);
int GetTabCount(void);
CWnd *GetTabWnd(int nIndex);
CString GetTabLabel(int nIndex);
void SetTabLabel(int nIndex, LPCTSTR szLabel); int GetTabIndex(void);
int GetTabIndex(CWnd *pWnd); void Enable(int nIndex, BOOL bEnable);
void EnableTab(int nIndex, BOOL bEnable);
void ShowTab(int nIndex, BOOL bShow);
BOOL IsTabEnabled(int nIndex);
BOOL IsTabVisible(int nIndex);
void SetFont(CFont *pFont);
void SetTabPos(TTabPos nTabPos); virtual int HitTest(int x, int y);
virtual int HitTest(CPoint& point); // Change active pane
virtual BOOL SetActivePane(int nIndex, BOOL bActivate = TRUE); // Em_ptSecondPos functions (implement in derived classes)
virtual BOOL CanSetActivePane(CWnd *pOldPane, CWnd *pNewPane);
virtual void OnSetActivePane(CWnd *pOldPane, CWnd *pNewPane);
protected:
//{{AFX_MSG(TTabWnd)
afx_msg LRESULT OnSizeParent(WPARAM, LPARAM lParam);
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
afx_msg void OnPaint();
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnDestroy();
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
//}}AFX_MSG
DECLARE_MESSAGE_MAP() friend class TVisualFramework;
};
第一个貌似是库引用冲突。例如你的dll使用多线程库,而exe使用单线程,或者反之个人不喜欢直接导出类的方式,这样使用类非常依赖编译器,透露了太多的实现细节给使用者