gpt4 book ai didi

C++ QT libXL 错误 : "During Startup program exited with code 0xc0000135"

转载 作者:搜寻专家 更新时间:2023-10-31 00:31:41 25 4
gpt4 key购买 nike

我正在尝试编写一个使用 libXL 的 QT 应用程序,但是当我尝试编译时,我收到一个弹出框,上面写着“在启动过程中程序以代码 0xc0000135 退出”。我已经确定是哪一行导致了问题,它是 startgame.cpp 中的 "Book* book = xlCreateBook();" 行。当我注释掉这一行时,程序运行正常。是否有可能我错误地设置了库?我将尝试在下面包含所有相关代码,在此先感谢您的帮助!

stattracker.pro

QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = Stattracker
TEMPLATE = app


SOURCES += main.cpp\
stattracker.cpp \
startgame.cpp

HEADERS += stattracker.h \
varstruct.h \
startgame.h

FORMS += stattracker.ui


win32: LIBS += -L$$PWD/libxl-3.6.4.0/lib/libxl.lib

INCLUDEPATH += $$PWD/libxl-3.6.4.0/include_cpp

主要.cpp

#include "stattracker.h"
#include <QApplication>
#include "varstruct.h"
#include <QString>
#include <windows.h>
#include <shlobj.h>


gameManager gm;
wchar_t homePath[MAX_PATH];
wchar_t awayPath[MAX_PATH];

int main(int argc, char *argv[])
{
QApplication a(argc, argv);

gm = *new gameManager;
homePath[MAX_PATH] = *new wchar_t;
awayPath[MAX_PATH] = *new wchar_t;

Stattracker w;
w.show();

return a.exec();
}

startgame.cpp

#include ...

void Stattracker::initializeVars()
{
//This function initializes all game variables to starting value

}

void Stattracker::newFile(QString path, QString firstName, QString lastName)
{
using namespace libxl;
Book* book = xlCreateBook(); //WHEN THIS LINE IS COMMENTED, THE PROGRAM COMPILES FINE
}

void Stattracker::getInput()
{
bool homePosition[11], homeOrder[10], awayPosition[11], awayOrder[10];
wchar_t my_documents[MAX_PATH];
gm.homeTeam.teamName = ui->teamName->text();
gm.awayTeam.teamName = ui->teamName_2->text();

HRESULT result = SHGetFolderPath(NULL,CSIDL_PERSONAL,NULL,SHGFP_TYPE_CURRENT,my_documents);
QString documentsPath = QString::fromWCharArray(my_documents);
QString homePathA = documentsPath + "\\Stattracker\\" + gm.homeTeam.teamName;
QString awayPathA = documentsPath + "\\Stattracker\\" + gm.awayTeam.teamName;
QString pathCheckA = documentsPath + "\\Stattracker\\";
QString curFileA;
wchar_t pathCheckB[MAX_PATH];
wchar_t curFile[MAX_PATH];
pathCheckA.toWCharArray(pathCheckB);
homePathA.toWCharArray(homePath);
awayPathA.toWCharArray(awayPath);

if((GetFileAttributes(pathCheckB))==INVALID_FILE_ATTRIBUTES)
{
CreateDirectory(pathCheckB, 0);
}
if((GetFileAttributes(homePath))==INVALID_FILE_ATTRIBUTES)
{
CreateDirectory(homePath, 0);
}
if((GetFileAttributes(awayPath))==INVALID_FILE_ATTRIBUTES)
{
CreateDirectory(awayPath, 0);
}


if(ui->firstName->text()!="First Name" && ui->lastName->text()!="Last Name")
{
gm.homeTeam.roster[0].firstName = ui->firstName->text();
gm.homeTeam.roster[0].lastName = ui->lastName->text();
curFileA = homePathA + "\\" + gm.homeTeam.roster[0].lastName + "_" + gm.homeTeam.roster[0].firstName + ".xls";
curFileA.toWCharArray(curFile);
if((GetFileAttributes(curFile))==INVALID_FILE_ATTRIBUTES)
{

}
}
}

void Stattracker::startGame()
{
initializeVars();
getInput();

}

让我知道是否应该包括任何其他文件(stattracker.cpp、stattracker.h 或 varstruct.h)

最佳答案

找到libxl.dll,把它和你的.exe放在同一个目录

关于C++ QT libXL 错误 : "During Startup program exited with code 0xc0000135",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33536614/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com