我正在除錯一個生成五個 dxf 檔案的代碼。第一代一切正常。一旦我開始創建第二個 dxf 檔案,我就會收到此錯誤。
有人可以幫助我并解釋我的問題。我無法發布整個代碼,因為代碼非常大。提前致謝
uj5u.com熱心網友回復:
這次失敗的原因是我錯誤地使用了這兩種資料型別:
const wchar_t*
wstring
class KDXFDWGWRAPPERTEIG_API K_ArcParameter {
private:
struct K_2DPoint { double m_point_1; double m_point_2; };
K_Teigha3DPoint m_arcCenter{ 0.0, 0.0, 0.0 };
K_Teigha3DPoint m_arcNormal{ 1.0, 1.0, 0.0 };
K_2DPoint m_arcAngleParameter{ 0.0, 3.14 };
K_DxfDwgColor m_defColor;
double m_radius = 1.0;
double m_thickness = 0.5;
const wchar_t* m_layerName = L""; // error is here
const wchar_t* m_lineType = L"";// error is here
public:
// C-Tor
K_ArcParameter(K_Teigha3DPoint pArcCenter, K_Teigha3DPoint pArcNormal, K_2DPoint pArcAngleParameter, double pRadius) :
m_arcCenter(pArcCenter), m_arcNormal(pArcNormal), m_arcAngleParameter(pArcAngleParameter), m_radius(pRadius), m_defColor(0x000000ff) {};
K_ArcParameter(K_Teigha3DPoint pArcCenter, K_Teigha3DPoint pArcNormal,K_2DPoint pArcAngleParameter, double pRadius, double pThickness, wstring& pLayerName, wstring& pLineType) :
m_arcCenter(pArcCenter), m_arcNormal(pArcNormal), m_arcAngleParameter(pArcAngleParameter), m_radius(pRadius), m_thickness(pThickness), m_layerName(pLayerName), m_lineType(pLineType), m_defColor(0x000000ff) {};
K_ArcParameter(K_Teigha3DPoint pArcCenter, K_Teigha3DPoint pArcNormal, K_2DPoint pArcAngleParameter, K_DxfDwgColor pDefColor, double pRadius, double pThickness, wstring& pLayerName, wstring& pLineType) :
m_arcCenter(pArcCenter), m_arcNormal(pArcNormal), m_arcAngleParameter(pArcAngleParameter), m_defColor(pDefColor), m_radius(pRadius), m_thickness(pThickness), m_layerName(pLayerName), m_lineType(pLineType) {};
//methods
K_Teigha3DPoint getArcCenterPoint() const { return m_arcCenter; }
K_Teigha3DPoint getArcNormal() const { return m_arcNormal; }
K_2DPoint getArcAngleParameter() const { return m_arcAngleParameter; }
K_DxfDwgColor getColor() const { return m_defColor; }
double getRadius() const { return m_radius; }
double getThickness() const { return m_thickness; }
wstring getLayerName() const { return m_layerName; }
wstring getLineTypeName() const { return m_lineType; }
bool IsLineTypeByLayer() const { return false; }
};
圖層名稱和線型名稱必須為wstring
. wchar_t*
不允許使用 const并使我的除錯器崩潰。很抱歉我沒有發布代碼,因為它非常廣泛,我無法看到具體的錯誤位置。我希望這可以幫助你們。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/452227.html