3

I am trying to write a QT application that uses libXL, but when I try to compile, I get a pop up box saying "During Startup program exited with code 0xc0000135". I have figured out exactly which line causes the problem, it is the "Book* book = xlCreateBook();" line in startgame.cpp. When I comment this line out, the program runs fine. Is it possible that I set up the library incorrectly? I will try to include all relevant code below, and thanks in advance for any help!

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

main.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();

}

Let me know if I should include any of the other files (stattracker.cpp, stattracker.h, or varstruct.h)

atomiczap
  • 91
  • 2
  • 3
  • http://stackoverflow.com/questions/11432940/what-does-error-code-0xc0000135-mean-when-starting-a-net-application – Cheers and hth. - Alf Nov 05 '15 at 05:19
  • Do you really have a problem with _compiling_ the program? Or with _running_? – Melebius Nov 05 '15 at 06:49
  • You are probably missing some required DLL, in your place I would look for some tool to analyze dependendecies and find out whats missing, I remember one util called depends.exe that could help, but I have not used windows for a few years so not sure if it still available – Marco Nov 05 '15 at 07:28
  • You are right, this issue was due to running. I figured out where to get the .dll and where to put it, and it works now! – atomiczap Nov 05 '15 at 16:21

1 Answers1

5

Find libxl.dll and place it in the same directory as you .exe

DannyK
  • 267
  • 2
  • 12