C++pi的定义
我定义了类CText
classCText:publicCDraw
{...
protected:
constfloatpi;
public:
CText();
CText(shortColorPen,shortColorBrush,shortLineWide,short
LineType,shortLayer,intid_only,BOOLDelete,floatStartX,floatStartY,floatAngle1,floatAngle2,floatTextHeight,floatTextWide,floatOffWide,unsignedcharTextFont,CStringText)
: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-Win32Debug--------------------
Compiling...
Draw.cpp
DrawDoc.cpp
DrawView.cpp
GeneratingCode...
Linking...
DrawDoc.obj:errorLNK2001:unresolvedexternalsymbol"public:void__thiscallCDraw::DPtoVP(float,float,int*,int*)"(?DPtoVP@CDraw@@QAEXMMPAH0@Z)
DrawDoc.obj:errorLNK2001:unresolvedexternalsymbol"public:int__thiscallCDraw::DLtoVL(float)"(?DLtoVL@CDraw@@QAEHM@Z)
Debug/Draw.exe:fatalerrorLNK1120:2unresolvedexternals
Errorexecutinglink.exe.
Draw.exe-3error(s),0warning(s)