首页 > 解决方案 > boost ptree read_ini 使独立应用程序崩溃

问题描述

我在 Windows 上使用带有 minGW 编译器的 CodeBlocks 和 wxWidgets。在项目的构建选项->搜索目录->编译器下,我有 boost 根文件夹,在资源编译器 wxWidgets-3.1.2/include 文件夹下。

通过 CodeBlocks 运行应用程序时,程序运行良好,没有错误。但是当我运行应用程序的 .exe 文件(来自 project_dir/bin)时,应用程序在 read_ini 行(消息框之间)崩溃。

这是我认为相关的代码的一部分:

#include <boost/property_tree/ini_parser.hpp>
boost::property_tree::ptree tree;
int result = FileDialog1->ShowModal();
if (result == wxID_OK)
{
    string f;
    try
    {
        f = string((FileDialog1->GetPath()).mb_str());
        try
        {
            wxMessageBox(_("asdf0 "));
            read_ini(f, tree);
            wxMessageBox(_("asdf1"));
        }
        catch (exception e)
        {
            wxMessageBox(_("Can't read file."));
            return;
        }

我不知道如何解决这个问题或从哪里开始。我试着用谷歌搜索了一下,但到目前为止还没有运气。

我将非常感谢任何帮助。如果您需要更多信息,请告诉我。

标签: c++boostcodeblockswxwidgetsptree

解决方案


推荐阅读