C++pi的定義
C++pi的定義
我定義了類(lèi)CText
class CText:public CDraw
{...
protected:
const float pi;
public:
CText();
CText(short ColorPen,short ColorBrush,short LineWide,short
LineType,short Layer,int id_only,BOOL Delete,float StartX,float StartY,float Angle1,float Angle2,float TextHeight,float TextWide,float OffWide,unsigned char TextFont,CString Text)
:CDraw(ColorPen,ColorBrush,LineWide,LineType,Layer,id_only,Delete),pi(float(3.14159265))
{
m_StartX=StartX;
m_StartY=StartY;
m_Angle1=Angle1;
m_Angle2=Angle2;
m_TextHeight=TextHeight;
m_TextWide=TextWide;
m_OffWide=OffWide;
m_TextLong=Text.GetLength(); //計(jì)算字符長(zhǎng)度
c_Text=Text;
}
}
...
};
但是顯示
--------------------Configuration: Draw - Win32 Debug--------------------
Compiling...
Draw.cpp
DrawDoc.cpp
DrawView.cpp
Generating Code...
Linking...
DrawDoc.obj : error LNK2001: unresolved external symbol "public: void __thiscall CDraw::DPtoVP(float,float,int *,int *)" (?DPtoVP@CDraw@@QAEXMMPAH0@Z)
DrawDoc.obj : error LNK2001: unresolved external symbol "public: int __thiscall CDraw::DLtoVL(float)" (?DLtoVL@CDraw@@QAEHM@Z)
Debug/Draw.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.
Draw.exe - 3 error(s), 0 warning(s)
我定義了類(lèi)CText
class CText:public CDraw
{...
protected:
const float pi;
public:
CText();
CText(short ColorPen,short ColorBrush,short LineWide,short
LineType,short Layer,int id_only,BOOL Delete,float StartX,float StartY,float Angle1,float Angle2,float TextHeight,float TextWide,float OffWide,unsigned char TextFont,CString Text)
:CDraw(ColorPen,ColorBrush,LineWide,LineType,Layer,id_only,Delete),pi(float(3.14159265))
{
m_StartX=StartX;
m_StartY=StartY;
m_Angle1=Angle1;
m_Angle2=Angle2;
m_TextHeight=TextHeight;
m_TextWide=TextWide;
m_OffWide=OffWide;
m_TextLong=Text.GetLength(); //計(jì)算字符長(zhǎng)度
c_Text=Text;
}
}
...
};
但是顯示
--------------------Configuration: Draw - Win32 Debug--------------------
Compiling...
Draw.cpp
DrawDoc.cpp
DrawView.cpp
Generating Code...
Linking...
DrawDoc.obj : error LNK2001: unresolved external symbol "public: void __thiscall CDraw::DPtoVP(float,float,int *,int *)" (?DPtoVP@CDraw@@QAEXMMPAH0@Z)
DrawDoc.obj : error LNK2001: unresolved external symbol "public: int __thiscall CDraw::DLtoVL(float)" (?DLtoVL@CDraw@@QAEHM@Z)
Debug/Draw.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.
Draw.exe - 3 error(s), 0 warning(s)
其他人氣:664 ℃時(shí)間:2020-03-17 09:30:58
優(yōu)質(zhì)解答
你這個(gè)是mfc工程吧?自己還是好好看看哪個(gè)工程的錯(cuò)誤吧,然后一點(diǎn)點(diǎn)把錯(cuò)誤的范圍縮小.已經(jīng)提示你是DrawDoc文件中的這個(gè)方法CDraw::DLtoVL(float)有問(wèn)題了,你自己在查查把.
我來(lái)回答
類(lèi)似推薦
猜你喜歡
- 1都有哪些東西可以和速度快或是加快速度有聯(lián)系的(物品,事件,詞語(yǔ),現(xiàn)象等)希望盡量全面些哦!
- 2英語(yǔ)動(dòng)詞填空what he said _______(record) just now. We can listen to it again.
- 3服裝廠(chǎng)生產(chǎn)襯衫,上半月完成計(jì)劃的45%,下半月比上半月多生產(chǎn)350件,剛好完成任務(wù).
- 4Tim was very______because many friends came to his birthday party.
- 5we moved to Canada in 2008變成否定句
- 6澄清石灰水中加鹽酸的離子方程式是?
- 7I think that it's a useful to learn a foreign-language.
- 8世界上有多少種字典?有多少種查字典的方法?應(yīng)該怎樣查?
- 9如果A>0,B>0,那么A+B>0 的逆命題,是真是假
- 10一個(gè)多邊形除了一個(gè)內(nèi)角外,其余各內(nèi)角之和為1680°,那么這個(gè)多邊形的邊數(shù)為_(kāi).
- 11鋁與硫酸鐵反應(yīng)
- 12把下列句子整理成一段通頗的話(huà),在括號(hào)里填上序號(hào).快的加50分~