如何处理这个断言调试失败

发布于 2025-01-16 06:28:17 字数 249 浏览 1 评论 0原文

我正在调试生成五个 dxf 文件的代码。第一代一切正常。当我开始创建第二个 dxf 文件时,我收到此错误。

输入图片这里的描述

有人可以帮助我并向我解释这个问题吗?我无法发布整个代码,因为代码非常大。 提前致谢

I am debugging a code that generates five dxf files. Everything works correctly for the first generation. As soon as I start creating the second dxf file I get this error.

enter image description here

Could someone help me and explain me the problem. I am not able to post the whole code because the code is very big.
thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

2025-01-23 06:28:17

失败的原因是我以错误的方式使用了这两种数据类型:

  1. const wchar_t*
  2. 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代码>. const wchar_t* 是不允许的,它会使我的调试器崩溃。很抱歉我没有发布代码,因为它非常广泛,而且我无法看到具体的错误位置。
我希望这可以帮助你们。

The reason for this failure was that I used these two data types in the wrong way:

  1. const wchar_t*
  2. 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; }

 };

The layer name and linetype name must be wstring. The const wchar_t* is not allowed and crashes my debugger. I'm sorry I didn't post the code as it's very extensive and I wasn't able to see the specific error location.
I hope this can help you guys.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文