C++pi的定义
C++pi的定义
我定义了类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(); //计算字符长度
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)
我定义了类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(); //计算字符长度
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)
其他人气:993 ℃时间:2020-03-17 09:30:58
优质解答
你这个是mfc工程吧?自己还是好好看看哪个工程的错误吧,然后一点点把错误的范围缩小.已经提示你是DrawDoc文件中的这个方法CDraw::DLtoVL(float)有问题了,你自己在查查把.
我来回答
类似推荐
猜你喜欢
- 1some studengts are in the classroom.变为同义句------ ------students are in t
- 2初一下学期英语选择题(急)
- 3“你的出生日是多少”可以翻译为“What's the date of your birth?
- 4怎么判断磁力矩的方向,
- 52^n>n^4对于哪些正整数n成立?证明你的结论
- 6有甲、乙两个数的和是176,如果加上丙数,这时3个数的平均数比甲乙两数平均数多3,丙数是_.
- 7在一定地域内生物与环境所形成的统一整体叫做_.
- 8He has to finish his work,so--- I
- 9艾米莉正在找一条黑色的丝绸裙子.Emily is _________________________________________.英语翻译
- 10已知气体密度水和二氧化碳的质量如何求烃的相对分子质量