Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Segmentation fault in QApplication constractor
Servers for Qt installer are currently down

Segmentation fault in QApplication constractor

Scheduled Pinned Locked Moved General and Desktop
segmentation faqapplication co
11 Posts 2 Posters 4.2k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi and welcome to devnet,

    I don't have any solaris system nor an old Qt version like that but from your code you're calling setCodecForTr and setCodecForCStrings too early. You need to first create the QApplication.

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    C 1 Reply Last reply
    0
    • SGaistS SGaist

      Hi and welcome to devnet,

      I don't have any solaris system nor an old Qt version like that but from your code you're calling setCodecForTr and setCodecForCStrings too early. You need to first create the QApplication.

      C Offline
      C Offline
      Coldman
      wrote on last edited by
      #3

      @SGaist thanks for your help. I chnaged my code, but this dnt help. I also use my exceptions in my project and multiple inheritance for one my class. My class inherits from simple class and QAbstractTableModel, and in header file of my class i declare
      class MyClass: public QAbstractTableModel, public SimpleClass
      {
      }

      May be reason is wrong generated code?

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #4

        What is SimpleClass ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        C 1 Reply Last reply
        0
        • SGaistS SGaist

          What is SimpleClass ?

          C Offline
          C Offline
          Coldman
          wrote on last edited by
          #5

          @SGaist SimpleClass is a clas, that created by me. It dnt inherits from other classes, ie dnt have parent class. I use this for comynicate with some external program

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #6

            Does the crash also happen if you only have:

            QApplication app(argc, argv);
            QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
            QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
            return app.exec();
            

            in your main ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            C 1 Reply Last reply
            0
            • SGaistS SGaist

              Does the crash also happen if you only have:

              QApplication app(argc, argv);
              QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
              QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
              return app.exec();
              

              in your main ?

              C Offline
              C Offline
              Coldman
              wrote on last edited by
              #7

              @SGaist yes, I'm sory, needed to send you my main code earlier.
              Look at my main code:
              #include <QtGui/QApplication>
              #include "MainWindow.h"
              #include <QTextCodec>
              #include "definitions.h"
              #include <iostream>

              int main(int argc, char *argv[]) {
              // initialize resources, if needed
              // Q_INIT_RESOURCE(resfile);
              #ifdef COMPILED
              std::cerr<<"Compiled date and time: "<<COMPILED<<"\n";
              #endif
              #ifdef VERSION
              std::cerr<<"Current veriosn: "<<VERSION<<"\n";
              #endif
              QApplication app(argc, argv);
              QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
              QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
              MainWindow Form1;
              Form1.show();
              return app.exec();
              }

              1 Reply Last reply
              0
              • C Offline
                C Offline
                Coldman
                wrote on last edited by
                #8

                I think solution is to look to code, that compiler generate.
                Douse anyone know how to decompile my object file?

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #9

                  Again: before trying to analyze the results of your compiler, can you run a default application ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  C 1 Reply Last reply
                  0
                  • SGaistS SGaist

                    Again: before trying to analyze the results of your compiler, can you run a default application ?

                    C Offline
                    C Offline
                    Coldman
                    wrote on last edited by
                    #10

                    @SGaist other projects run correct.
                    I get solution - use g++ compiler and gmake instead of solaris compiler and dmake.
                    My project work correct now

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #11

                      If you want to use the solaris compiler with Qt you probably have to first recompile Qt yourself. Anyway, switching to g++ is not a bad idea in this case.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved