2014-12-23 107 views
1

我試圖在Visual Studio 2013上運行此程序,但是當我包含object - myparser.obj我收到以下錯誤:錯誤LNK2001:無法解析的外部符號「ATL :: CTraceCategory ATL :: atlTraceException」(?atlTraceException @ ATL @@ 3VCTraceCategory @ 1 @)

1>MyParser.obj : error LNK2001: unresolved external symbol "class ATL::CTraceCategory ATL::atlTraceException" ([email protected]@@[email protected]@A) 
1>MyParser.obj : error LNK2001: unresolved external symbol "public: static class ATL::CTrace ATL::CTrace::s_trace" ([email protected]@[email protected]@[email protected]) 
1>MyParser.obj : error LNK2019: unresolved external symbol _AtlTraceVA referenced in function "public: void __cdecl ATL::CTrace::TraceV(char const *,int,unsigned long,unsigned int,char const *,char *)const " ([email protected]@[email protected]@[email protected]) 

myparser有什麼問題嗎?或者它是別的嗎?

Code4A.h

#include <afxwin.h> 
#define IDC_BUTTON 501 
#define nInput 6 

extern double parse(CString,int,double [],int []); 

class CCode4A : public CFrameWnd 
{ 
protected: 
typedef struct 
{ 
    CString label,item; 
    CPoint hm; 
    CEdit ed; 
    CRect rc,display; 
} INPUT; 
INPUT input[nInput+1]; 
CStatic result; 
CFont Arial80; 
CButton btn; 
int idc; 
public: 
CCode4A(); 
~CCode4A(); 
afx_msg void OnPaint(),OnButton(); 
DECLARE_MESSAGE_MAP() 
}; 

class CMyWinApp : public CWinApp 
{ 
public: 
virtual BOOL InitInstance(); 
}; 

Code4A.cpp

#include "Code4A.h" 

CMyWinApp MyApplication; 

BOOL CMyWinApp::InitInstance() 
{ 
CCode4A* pFrame = new CCode4A; 
m_pMainWnd = pFrame; 
pFrame->ShowWindow(SW_SHOW); 
pFrame->UpdateWindow(); 
return TRUE; 
} 

BEGIN_MESSAGE_MAP(CCode4A,CFrameWnd) 
ON_WM_PAINT() 
ON_BN_CLICKED(IDC_BUTTON,OnButton) 
END_MESSAGE_MAP() 

CCode4A::CCode4A() 
{ 
Create(NULL,"Code4A: Scientific Calculator", 
    WS_OVERLAPPEDWINDOW,CRect(0,0,700,350),NULL); 
Arial80.CreatePointFont(80,"Arial"); 
idc=301; 
input[0].hm=CPoint(200,20); 
for (int i=1;i<=nInput;i++) 
    input[i].hm=CPoint(input[0].hm.x+10,input[0].hm.y+50+(i-1)*30); 
input[1].label="t"; 
input[2].label="u"; 
input[3].label="v"; 
input[4].label="x"; 
input[5].label="y"; 
input[6].label="Expression"; 
btn.Create("Compute",WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON, 
    CRect(CPoint(input[0].hm.x,input[0].hm.y+5),CSize(100,20)), 
    this,IDC_BUTTON); 
for (i=1;i<=nInput-1;i++) 
    input[i].ed.Create(WS_CHILD | WS_VISIBLE | WS_BORDER, 
    CRect(input[i].hm.x+70,input[i].hm.y,input[i].hm.x+150, 
    input[i].hm.y+20),this,idc++); 
input[nInput].ed.Create(WS_CHILD | WS_VISIBLE | WS_BORDER, 
    CRect(input[nInput].hm.x+70,input[nInput].hm.y, 
    input[nInput].hm.x+350,input[nInput].hm.y+20),this,idc++); 
result.Create("",WS_CHILD | WS_VISIBLE | SS_CENTER | WS_BORDER, 
     CRect(input[nInput].hm.x+50,input[nInput].hm.y+50, 
     input[6].hm.x+150,input[6].hm.y+70),this,idc++); 
} 

CCode4A::~CCode4A() 
{ 
} 

void CCode4A::OnPaint() 
{ 
CPaintDC dc(this); 
CString str; 
dc.SelectObject(Arial80); 
dc.SetBkColor(RGB(255,255,255)); 
dc.SetTextColor(RGB(100,100,100)); 
for (int i=1;i<=nInput;i++) 
    dc.TextOut(input[i].hm.x,input[i].hm.y,input[i].label); 
dc.TextOut(input[6].hm.x,input[6].hm.y+50,"Result"); 
} 

void CCode4A::OnButton() 
{ 
CString str; 
int i,psi[nInput+1]; 
double z,psv[nInput+1]; 
for (i=1;i<=nInput;i++) 
    input[i].ed.GetWindowText(input[i].item); 
psi[1]=19; 
psi[2]=20; 
psi[3]=21; 
psi[4]=23; 
psi[5]=24; 
for (i=1;i<=nInput;i++) 
    psv[i]=atof(input[i].item); 
z=parse(input[nInput].item,5,psv,psi); 
str.Format("%lf",z); 
result.SetWindowText(str); 
} 

回答

1

檢查項目設置,你缺少連接輸入atls.lib。

項目設置爲/ NODEFAULTLIB並明確鏈接它atls.lib

/NODEFAULTLIB

+0

它使誤差非常繁殖; /故障與解析器,當我刪除它和所有的代碼,使用它的問題消失。 – user3527454

相關問題