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

Segmentation fault in QApplication constractor

Scheduled Pinned Locked Moved General and Desktop
segmentation faqapplication co
11 Posts 2 Posters 4.0k Views
  • 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.
  • S Offline
    S Offline
    SGaist
    Lifetime Qt Champion
    wrote on 29 Sept 2015, 20:25 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 30 Sept 2015, 05:55
    0
    • S SGaist
      29 Sept 2015, 20:25

      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 30 Sept 2015, 05:55 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
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 30 Sept 2015, 09:23 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 30 Sept 2015, 10:51
        0
        • S SGaist
          30 Sept 2015, 09:23

          What is SimpleClass ?

          C Offline
          C Offline
          Coldman
          wrote on 30 Sept 2015, 10:51 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
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 30 Sept 2015, 22:06 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 1 Oct 2015, 05:37
            0
            • S SGaist
              30 Sept 2015, 22:06

              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 1 Oct 2015, 05:37 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 1 Oct 2015, 10:23 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
                • S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 1 Oct 2015, 20:20 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 2 Oct 2015, 13:19
                  0
                  • S SGaist
                    1 Oct 2015, 20:20

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

                    C Offline
                    C Offline
                    Coldman
                    wrote on 2 Oct 2015, 13:19 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
                    • S Offline
                      S Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on 2 Oct 2015, 21:04 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

                      11/11

                      2 Oct 2015, 21:04

                      • Login

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