Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/qt/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 运行我的qt应用程序时出现错误Bex_C++_Qt_Dll - Fatal编程技术网

C++ 运行我的qt应用程序时出现错误Bex

C++ 运行我的qt应用程序时出现错误Bex,c++,qt,dll,C++,Qt,Dll,我正在编写一个应用程序,将降价转换为html。并基于“cpp markdown”为此构建了一个dll,名为markdown2html.dll。dll在我的测试程序中运行良好,但在我的qt应用程序中失败。代码如下: QString tNotesTextEditor::markdown2html(QString articleContents){ QLibrary convertLib(tr("markdown2html.dll")); std::string result; if(convert

我正在编写一个应用程序,将降价转换为html。并基于“cpp markdown”为此构建了一个dll,名为markdown2html.dll。dll在我的测试程序中运行良好,但在我的qt应用程序中失败。代码如下:

QString tNotesTextEditor::markdown2html(QString articleContents){

QLibrary convertLib(tr("markdown2html.dll"));
std::string result;
if(convertLib.load()){
    QMessageBox::information(NULL, "OK", "DLL load is OK!");
    typedef std::string (*Fun)(std::string);
    Fun convertFunc = (Fun)convertLib.resolve("markdown2HTML");
    if(convertFunc){
        QMessageBox::information(NULL, "OK", "Function is found");
        std::string locale_text = articleContents.toLocal8Bit().constData();
        QMessageBox::information(NULL, "OK", "to stdstring is well");
        result = convertFunc("helloworld");
        QMessageBox::information(NULL, "OK", "Function works well");
        //QMessageBox::information(NULL, "OK", QString::fromLocal8Bit(result.c_str()));
        return QString::fromStdString(result.c_str());
    } else {
        QMessageBox::information(NULL, "OK", "Function not found");
        return NULL;
    }
} else {
    QMessageBox::information(NULL, "OK", "Lib not found");
    return NULL;
}

}
“运行良好”消息从未显示,我收到错误消息:

问题事件名称: BEX
应用程序名:  tNotes_client.exe
应用程序版本: 0.0.0.0
应用程序时间戳:    532af665
故障模块名称: StackHash_0a9e
故障模块版本: 0.0.0.0
故障模块时间戳:    00000000
异常偏移:   0028d3c9
异常代码:   c0000005
异常数据:   badc0de1
OS 版本:  6.1.7601.2.1.0.256.48
区域设置 ID:    2052
其他信息 1: 0a9e
其他信息 2: 0a9e372d3b4ad19135b953a78882e789
其他信息 3: 0a9e
其他信息 4: 0a9e372d3b4ad19135b953a78882e789
我已经关闭了我的应用程序的DEP,因为网站上说:


但是它不工作。

最后,我发现我的Qt创建者的默认编译器是mingw,而dll是用VC编译的。这两个编译器之间应该存在一些差异,并且std::string(在我的例子中是“helloworld”)不能正确地传递给DLL中的函数

所以我的解决方案是用同一个编译器编译所有代码。
谢谢

中文错误消息没有帮助。此外,如果您提供DLL的include标头,以便人们可以查看函数签名,也会有所帮助。@Silicomancer感谢您的建议!