crossplatform.ru

Здравствуйте, гость ( Вход | Регистрация )


  Ответ в Не хочет запускаться Qt приложение под виндой
Введите ваше имя
Подтвердите код

Введите в поле код из 6 символов, отображенных в виде изображения. Если вы не можете прочитать код с изображения, нажмите на изображение для генерации нового кода.
 

Опции сообщения
 Включить смайлы?
Иконки сообщения
(Опционально)
                                
                                
  [ Без иконки ]
 


Последние 10 сообщений [ в обратном порядке ]
domiurg Дата 26.5.2011, 8:02
 
Цитата(Kagami @ 26.5.2011, 12:36) *
Если собирал mingw, то надо еще libgcc_s_dw2-1.dll и mingwm10.dll, если MSVS - то соответствующий vcredist нужно поставить. Есть еще программка Dependency Walker, она показывает какие библиотеки приложению нужны и каких ей не хватает.


Собирал его MSVS, обьясните как ставить vcredist

а вот насчёт Dependency Walker:

я натравил его на екзешник, после чего он аказал что не хватает msjava.dll и ругаеться вот так:
Цитата
Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.

на mpr.dll


Вопрос решился!!

Это я дурак, простите) таки vsredist надо было поставить. Всем Огромное спасибо
Litkevich Yuriy Дата 26.5.2011, 7:48
  возьми Dependency walker и посмотри какие dll-ки нужны программе
Kagami Дата 26.5.2011, 7:36
  Если собирал mingw, то надо еще libgcc_s_dw2-1.dll и mingwm10.dll, если MSVS - то соответствующий vcredist нужно поставить. Есть еще программка Dependency Walker, она показывает какие библиотеки приложению нужны и каких ей не хватает.
domiurg Дата 26.5.2011, 6:07
  вот пофиксил, теперь только Qt

window.cpp:
#include "window.h"
#include <QMenu>
#include <QMenuBar>
#include <QApplication>
#include <QFileDialog>
#include <QDesktopWidget>
#include <QString>
#include <QPushButton>
#include <QList>
#include <QFile>
#include <QTextStream>

QString Data;
int numLines;

void center(QWidget &widget, int w, int h)
{
  int x, y;
  int screenWidth;
  int screenHeight;

  QDesktopWidget *desktop = QApplication::desktop();

  screenWidth = desktop->width();
  screenHeight = desktop->height();

  x = (screenWidth - w) / 2;
  y = (screenHeight - h) / 2;

  widget.move( x, y );
}


Window::Window(QWidget *parent)
    : QMainWindow(parent)
{
    int WIDTH = 450, HEIGHT = 350;

    setFixedSize(WIDTH,HEIGHT);

    QPixmap openpix("pics/open.jpg");
    QPixmap quitpix("pics/quit.jpg");

    QAction *open = new QAction(openpix, "&Open", this);
    open->setShortcut(tr("CTRL+O"));
    QAction *quit = new QAction(quitpix, "&Close", this);
    quit->setShortcut(tr("CTRL+Q"));

    QMenu *file;
    file = menuBar()->addMenu("&File");
    file->addAction(open);
    file->addSeparator();
    file->addAction(quit);

    label1 = new QLabel("0", this);
    label1->setGeometry(5,20,450,30);
    label1->setText("Current file: None");

    QLabel *label2 = new QLabel("0",this);
    label2->setGeometry(5,40,450,150);
    label2->setWordWrap(true);
    label2->setText("READ BEFORE USE!!\nFirst of all change the extencion of your !!*.PXL!! file to !!TXT!! and then click @file->open@, choose your renamed file and after that click @Generate htm file@, choose destination file and save. After that enjoy your HTM file with table!");

    QPushButton *generate = new QPushButton("Generate htm file", this);
    generate->setGeometry(150, 165, 150, 40);

    label3 = new QLabel("0",this);
    label3->setGeometry(5,210,450,60);
    label3->setWordWrap(true);
    label3->setText("Generated file: None");

    center(*this, WIDTH,HEIGHT);

    connect(open, SIGNAL(triggered()), this, SLOT(OpenFile()));
    connect(quit, SIGNAL(triggered()), qApp, SLOT(quit()));
    connect(generate, SIGNAL(clicked()), this, SLOT(htmGenerator()));
}

void Window::OpenFile()
{
    QString fileName = QFileDialog::getOpenFileName(
            this,
            tr("open File"),
            QDir::currentPath(),
            tr("txt Files (*.txt)") );
    if (fileName.isEmpty ()) {
      return;
    }

    int found=0;
    QChar ch1 = 47, ch2 = 92;
    found = fileName.lastIndexOf(ch1);
    if (found == 0) found = fileName.lastIndexOf(ch2);
    label1->setText("Current file: "+fileName.mid(found+1));

    QFile input(fileName);
    int Lines=0;
    if(input.open(QFile::ReadOnly))
    {
        QTextStream in(&input);

        QString temp;
        do
        {
            temp = in.read(1);
            ch1=temp[0];
            if ((ch1 >= 32 && ch1<=127) || ch1 == 10)
                Data = Data + temp;
            if (ch1 == 10) Lines++;
        } while (!temp.isNull());
    }
    input.close();
    numLines=Lines;
}

void Window::htmGenerator() //generates html file
{
    QList<QString> Lines;

    int start=0, length=0;

    for (int i=0; i<Data.length(); i++)
    {
        QChar ch = Data[i];
        length++;
        if (ch == 10)
        {
            Lines << Data.mid(start,length);
            start = i;
            length=0;
        }
    }

    QString sfilename = QFileDialog::getSaveFileName(
            this,
            tr("Save to *.htm File"),
            QDir::currentPath(),
                tr("htm Files (*.htm);;html Files (*.html)") );
    if (sfilename.isEmpty ()) {
      return;
    }

    QString h1=".htm";
    QString h2=".html";
    if (!sfilename.contains(h1, Qt::CaseInsensitive) && !sfilename.contains(h2, Qt::CaseInsensitive))
    {sfilename = sfilename + h1;}

    QFile htm(sfilename);

    if (htm.open(QFile::ReadWrite))
    {
    QTextStream out(&htm);
    const QString top = "<html>\n<body>\n<center>\n<font color=green face=ComicSansMS>";
    const QString bottom = "</body>\n</html>";
    const QString tablec ="\n</table>\n</center>\n";
    const QString tableo = "</font>\n<table border=1 width=100%>";
    const QString fline = "<tr>\n<td>Trial</td>\n<td>stimuli-OnsetError</td>\n<td>stimuli-OnsetTime</td>\n"\
                          "<td>choice-OnsetError</td>\n<td>choice-OnsetTime</td>\n<td>choice-Mouse-IsCorrect</td>\n"\
                          "<td>choice-Mouse-Responses</td>\n<td>choice-Mouse-ResponseTime</td>\n"\
                          "<td>TrialTable-Column1</td>\n<td>TrialTable-correct resposes</td>\n</tr>";
    const QString tro ="<tr height=40>";
    const QString trc ="</tr>";
    const QString tdo ="<td><center>";
    const QString tdc ="</center></td>";
    const QString br ="<br>";

    int correct=0;

    out << top;

    for(int i=0; i<Lines.size();i++)
    {
        if (Lines[i].contains("**")){/*Do Nothing*/}
        else if (Lines[i].contains("SubjectName",Qt::CaseInsensitive))
        {
            out << "Subject Name: ";
            out << Lines[i].remove("SubjectName^",Qt::CaseInsensitive) << br;
        } else if (Lines[i].contains("SessionNumber^",Qt::CaseInsensitive))
        {
            out << "SessionNumber: ";
            out << Lines[i].remove("SessionNumber^",Qt::CaseInsensitive) << br;

        } else if (Lines[i].contains("ExperimentName^",Qt::CaseInsensitive))
        {
            out << "ExperimentName";
            out << Lines[i].remove("ExperimentName^",Qt::CaseInsensitive) << br;
            out << tableo << fline;
        };

        if (Lines[i].contains("Trial^",Qt::CaseInsensitive))
        {
            out<<tro<<tdo;
            out<<Lines[i].remove("Trial^",Qt::CaseInsensitive);
            out<<tdc;
        } else if(Lines[i].contains("stimuli-OnsetError^",Qt::CaseInsensitive))
        {
            out<<tdo;
            out<<Lines[i].remove("stimuli-OnsetError^",Qt::CaseInsensitive);
            out<<tdc;
        } else if(Lines[i].contains("stimuli-OnsetTime^",Qt::CaseInsensitive))
        {
            out<<tdo;
            out<<Lines[i].remove("stimuli-OnsetTime^",Qt::CaseInsensitive);
            out<<tdc;
        } else if(Lines[i].contains("choice-OnsetError^",Qt::CaseInsensitive))
        {
            out<<tdo;
            out<<Lines[i].remove("choice-OnsetError^",Qt::CaseInsensitive);
            out<<tdc;
        } else if(Lines[i].contains("choice-OnsetTime^",Qt::CaseInsensitive))
        {
            out<<tdo;
            out<<Lines[i].remove("choice-OnsetTime^",Qt::CaseInsensitive);
            out<<tdc;
        } else if(Lines[i].contains("choice-Mouse-IsCorrect^",Qt::CaseInsensitive))
        {
            out<<tdo;
            out<<Lines[i].remove("choice-Mouse-IsCorrect^",Qt::CaseInsensitive);
            if (Lines[i].contains("1")) correct++;
            out<<tdc;
        } else if(Lines[i].contains("choice-Mouse-Responses^",Qt::CaseInsensitive))
        {
            out<<tdo;
            out<<Lines[i].remove("choice-Mouse-Responses^",Qt::CaseInsensitive);
            out<<tdc;
        } else if(Lines[i].contains("choice-Mouse-ResponseTime^",Qt::CaseInsensitive))
        {
            out<<tdo;
            out<<Lines[i].remove("choice-Mouse-ResponseTime^",Qt::CaseInsensitive);
            out<<tdc;
        } else if(Lines[i].contains("TrialTable-Column1^",Qt::CaseInsensitive))
        {
            out<<tdo;
            out<<Lines[i].remove("TrialTable-Column1^",Qt::CaseInsensitive);
            out<<tdc;
        } else if(Lines[i].contains("TrialTable-correct resposes^",Qt::CaseInsensitive))
        {
            out<<tdo;
            out<<Lines[i].remove("TrialTable-correct resposes^",Qt::CaseInsensitive);
            out<<tdc<<trc;
        }
    }
    out << tablec;
    out << "\n<center>\n<font color=green size=20 face=ComicSansMS>\nNumber of correct ansvers: ";
    out << QString::number(correct,10);
    out << "</center></font>";
    out << bottom;
    }

    htm.close();

    int found=0;
    QChar ch1 = 47, ch2 = 92;
    found = sfilename.lastIndexOf(ch1);
    if (found == 0) found = sfilename.lastIndexOf(ch2);
    label3->setText("Generated file: "+sfilename.mid(found+1));

}


ну и соответственно в хедере тоже убрал упоминания об stl,

всё равно, собранное в режиме релиз под чистенькой виртуалкой не пашет(
domiurg Дата 26.5.2011, 4:20
  У меня туда примешан Чуток stl, а именно стринга std-шная, а так всё. Не верю я что она мне весь коленкор портит.

вот хедер:

window.h
#ifndef WINDOW_H
#define WINDOW_H

#include <QMainWindow>
#include <QLabel>
#include <QTextEdit>
#include <fstream>
#include <string>

using namespace std;

class Window : public QMainWindow
{
    Q_OBJECT

public:
    Window(QWidget *parent = 0);


private slots:
    void OpenFile();
    void htmGenerator();
private:
    QLabel *label1, *label3;
};

#endif // WINDOW_H


вот мой срр-шник от хедера:
window.cpp
#include "window.h"
#include <QMenu>
#include <QMenuBar>
#include <QApplication>
#include <QFileDialog>
#include <QDesktopWidget>
#include <QString>
#include <QPushButton>
#include <QList>
#include <QFile>
#include <QTextStream>

string Data;
int numLines;

void center(QWidget &widget, int w, int h)
{
  int x, y;
  int screenWidth;
  int screenHeight;

  QDesktopWidget *desktop = QApplication::desktop();

  screenWidth = desktop->width();
  screenHeight = desktop->height();

  x = (screenWidth - w) / 2;
  y = (screenHeight - h) / 2;

  widget.move( x, y );
}


Window::Window(QWidget *parent)
    : QMainWindow(parent)
{
    int WIDTH = 450, HEIGHT = 350;

    setFixedSize(WIDTH,HEIGHT);

    QPixmap openpix("pics/open.jpg");
    QPixmap quitpix("pics/quit.jpg");

    QAction *open = new QAction(openpix, "&Open", this);
    open->setShortcut(tr("CTRL+O"));
    QAction *quit = new QAction(quitpix, "&Close", this);
    quit->setShortcut(tr("CTRL+Q"));

    QMenu *file;
    file = menuBar()->addMenu("&File");
    file->addAction(open);
    file->addSeparator();
    file->addAction(quit);

    label1 = new QLabel("0", this);
    label1->setGeometry(5,20,450,30);
    label1->setText("Current file: None");

    QLabel *label2 = new QLabel("0",this);
    label2->setGeometry(5,40,450,150);
    label2->setWordWrap(true);
    label2->setText("READ BEFORE USE!!\nFirst of all change the extencion of your !!*.PXL!! file to !!TXT!! and then click @file->open@, choose your renamed file and after that click @Generate htm file@, choose destination file and save. After that enjoy your HTM file with table!");

    QPushButton *generate = new QPushButton("Generate htm file", this);
    generate->setGeometry(150, 165, 150, 40);

    label3 = new QLabel("0",this);
    label3->setGeometry(5,210,450,60);
    label3->setWordWrap(true);
    label3->setText("Generated file: None");

    center(*this, WIDTH,HEIGHT);

    connect(open, SIGNAL(triggered()), this, SLOT(OpenFile()));
    connect(quit, SIGNAL(triggered()), qApp, SLOT(quit()));
    connect(generate, SIGNAL(clicked()), this, SLOT(htmGenerator()));
}

void Window::OpenFile()
{

    //QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"),"",tr("TXT Files (*.txt)"));
    QString fileName = QFileDialog::getOpenFileName(
            this,
            tr("open File"),
            QDir::currentPath(),
            tr("txt Files (*.txt)") );
    if (fileName.isEmpty ()) {
      return;
    }

    string name = fileName.toStdString();

    int found=0;
    found=name.find_last_of("/\\");
    QString filenam = QString::fromStdString(name.substr(found+1));
    label1->setText("Current file: "+filenam);

    const char* fname;
    fname = name.c_str();

    ifstream in(fname,ios::in);

    char ch;
    int Lines=0;
    Data="";

    while (!in.eof())
    {
        ch = in.get();
        if ((ch >= 32 && ch<=127) || ch == 10)
        Data = Data + ch;
        if (ch == 10) Lines++;
    }

    in.close();
    numLines = Lines;
}

void Window::htmGenerator() //generates html file
{
    QList<QString> Lines;

    /*QString l;
    label1->setText(l);*/

    int start=0, length=0;

    for (unsigned int i=0; i<Data.length(); i++)
    {
        char ch = Data[i];
        length++;
        if (ch == 10)
        {
            Lines << QString::fromStdString(Data.substr(start,length));
            start = i;
            length=0;
        }
    }

    QString sfilename = QFileDialog::getSaveFileName(
            this,
            tr("Save to *.htm File"),
            QDir::currentPath(),
                tr("htm Files (*.htm);;html Files (*.html)") );
    if (sfilename.isEmpty ()) {
      return;
    }

    //QString l;
    //label1->setText(sfilename.right(3));

    QString h1=".htm";
    QString h2=".html";
    if (!sfilename.contains(h1, Qt::CaseInsensitive) && !sfilename.contains(h2, Qt::CaseInsensitive))
    {sfilename = sfilename + h1;}

    QFile htm(sfilename);

    if (htm.open(QFile::ReadWrite))
    {
    QTextStream out(&htm);
    const QString top = "<html>\n<body>\n<center>\n<font color=green face=ComicSansMS>";
    const QString bottom = "</body>\n</html>";
    const QString tablec ="\n</table>\n</center>\n";
    const QString tableo = "</font>\n<table border=1 width=100%>";
    const QString fline = "<tr>\n<td>Trial</td>\n<td>stimuli-OnsetError</td>\n<td>stimuli-OnsetTime</td>\n"\
                          "<td>choice-OnsetError</td>\n<td>choice-OnsetTime</td>\n<td>choice-Mouse-IsCorrect</td>\n"\
                          "<td>choice-Mouse-Responses</td>\n<td>choice-Mouse-ResponseTime</td>\n"\
                          "<td>TrialTable-Column1</td>\n<td>TrialTable-correct resposes</td>\n</tr>";
    const QString tro ="<tr height=40>";
    const QString trc ="</tr>";
    const QString tdo ="<td><center>";
    const QString tdc ="</center></td>";
    const QString br ="<br>";

    int correct=0;

    out << top;

    for(int i=0; i<Lines.size();i++)
    {
        if (Lines[i].contains("**")){/*Do Nothing*/}
        else if (Lines[i].contains("SubjectName",Qt::CaseInsensitive))
        {
            out << "Subject Name: ";
            out << Lines[i].remove("SubjectName^",Qt::CaseInsensitive) << br;
        } else if (Lines[i].contains("SessionNumber^",Qt::CaseInsensitive))
        {
            out << "SessionNumber: ";
            out << Lines[i].remove("SessionNumber^",Qt::CaseInsensitive) << br;

        } else if (Lines[i].contains("ExperimentName^",Qt::CaseInsensitive))
        {
            out << "ExperimentName";
            out << Lines[i].remove("ExperimentName^",Qt::CaseInsensitive) << br;
            out << tableo << fline;
        };

        if (Lines[i].contains("Trial^",Qt::CaseInsensitive))
        {
            out<<tro<<tdo;
            out<<Lines[i].remove("Trial^",Qt::CaseInsensitive);
            out<<tdc;
        } else if(Lines[i].contains("stimuli-OnsetError^",Qt::CaseInsensitive))
        {
            out<<tdo;
            out<<Lines[i].remove("stimuli-OnsetError^",Qt::CaseInsensitive);
            out<<tdc;
        } else if(Lines[i].contains("stimuli-OnsetTime^",Qt::CaseInsensitive))
        {
            out<<tdo;
            out<<Lines[i].remove("stimuli-OnsetTime^",Qt::CaseInsensitive);
            out<<tdc;
        } else if(Lines[i].contains("choice-OnsetError^",Qt::CaseInsensitive))
        {
            out<<tdo;
            out<<Lines[i].remove("choice-OnsetError^",Qt::CaseInsensitive);
            out<<tdc;
        } else if(Lines[i].contains("choice-OnsetTime^",Qt::CaseInsensitive))
        {
            out<<tdo;
            out<<Lines[i].remove("choice-OnsetTime^",Qt::CaseInsensitive);
            out<<tdc;
        } else if(Lines[i].contains("choice-Mouse-IsCorrect^",Qt::CaseInsensitive))
        {
            out<<tdo;
            out<<Lines[i].remove("choice-Mouse-IsCorrect^",Qt::CaseInsensitive);
            if (Lines[i].contains("1")) correct++;
            out<<tdc;
        } else if(Lines[i].contains("choice-Mouse-Responses^",Qt::CaseInsensitive))
        {
            out<<tdo;
            out<<Lines[i].remove("choice-Mouse-Responses^",Qt::CaseInsensitive);
            out<<tdc;
        } else if(Lines[i].contains("choice-Mouse-ResponseTime^",Qt::CaseInsensitive))
        {
            out<<tdo;
            out<<Lines[i].remove("choice-Mouse-ResponseTime^",Qt::CaseInsensitive);
            out<<tdc;
        } else if(Lines[i].contains("TrialTable-Column1^",Qt::CaseInsensitive))
        {
            out<<tdo;
            out<<Lines[i].remove("TrialTable-Column1^",Qt::CaseInsensitive);
            out<<tdc;
        } else if(Lines[i].contains("TrialTable-correct resposes^",Qt::CaseInsensitive))
        {
            out<<tdo;
            out<<Lines[i].remove("TrialTable-correct resposes^",Qt::CaseInsensitive);
            out<<tdc<<trc;
        }
    }
    out << tablec;
    out << "\n<center>\n<font color=green size=20 face=ComicSansMS>\nNumber of correct ansvers: ";
    out << QString::number(correct,10);
    out << "</center></font>";
    out << bottom;
    }

    htm.close();

    label3->setText("Generated file: "+sfilename);

}
RazrFalcon Дата 25.5.2011, 21:24
  Может хоть часть исходников покажете. Ничего же не понятно.
У вас там точно ничего НЕ кросплаторменного не используется?
domiurg Дата 25.5.2011, 20:12
  Собрал в релиз моде, запустил под виртуалкой и снова не запускаеться с тем же окном ошибки(
domiurg Дата 25.5.2011, 19:33
 
Цитата(Авварон @ 26.5.2011, 0:29) *
Для начала - собрать в релизе


А где это, объясните мне тёмному...
Авварон Дата 25.5.2011, 19:29
  Для начала - собрать в релизе
domiurg Дата 25.5.2011, 19:18
  Дело такое:

Я написал под Линуксом GUI Приложение под Qt. Читает из одного файлика несортированную дату и загоняет её в html файлик в виде таблички, Не суть важно.

Затем под Виндой (Хр) в Креэйторе я его скомпилил под винду, затем взял экзешничек в отделюную папочку, засунул к нему QtGuid4.dll и QtCored4.dll, после этого программка бодро запускалась на моей винде.

затем папочку с прогой и длл-ками я скинул подруге, у которой на компе стоит Вин7 и Qt ни в каком виде даже не стоит. У неё приложение не запустилось, и выдало:

Цитата
the application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.ese tool for more detail


Затем я запустил это же добро под виртуалкой у сябя на компе (та же Хр),
У меня тоже не запустилось и выдало:


Цитата
Приложение не может быть запущёно, поскольку оно некорректно настроено. Повторная установка приложения может решить эту проблемму.

И вот ВОПРОС: А как надо компилить под виндой Кьюти-шные приложения, чтоб они запускались под другими Виндовс системами?? И собственно чтоб моё приложение тоже запустилось.
Просмотр темы полностью (откроется в новом окне)
RSS Текстовая версия Сейчас: 28.3.2024, 21:47