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. Solved Problem in Compiling 3MB size class(.cpp) in GUI Application
Forum Updated to NodeBB v4.3 + New Features

Solved Problem in Compiling 3MB size class(.cpp) in GUI Application

Scheduled Pinned Locked Moved General and Desktop
8 Posts 4 Posters 2.6k Views 1 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.
  • Z Offline
    Z Offline
    Zain
    wrote on last edited by
    #1

    Hello All,

    In my gui application I have 5 classes with size of 2-3 MB.When I am compiling my application it is seem to be hang and not able to make .o file of that classes.

    I am using Qt4.8.1 and MinGW compiler.

    Am i need to go with advance qt version like QT5.will it do any help to me?
    Please help me how can I compile big size class.

    Thanks in Advance.
    Zain

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      question: why do you have such big class files at all?
      Why not modularize your source? This has the nice side effect that building/linking is much faster in long terms...

      Since it seems that your compiler refuses to work an "upgrade" to Qt5 wont help either.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • M Offline
        M Offline
        MuldeR
        wrote on last edited by
        #3

        3 MB of "real" (handwritten) code, i.e. nothing that was auto-generated in some way, in a single file would really be extraordinary. Must be several ten-thousands of lines. So you probably want to refactor that code into multiple files/classes, regardless of the compiler issues. Anyway, Qt's resource compiler (RCC) can easily generate C++ files of that size (or larger), when you "embed" larger files (like images) into your program. The compiler handles those large C++ files just fine in my experience. Might be because they mostly consist of static data though...

        My OpenSource software at: http://muldersoft.com/

        Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

        Go visit the coop: http://youtu.be/Jay...

        1 Reply Last reply
        0
        • B Offline
          B Offline
          b1gsnak3
          wrote on last edited by
          #4

          2-3 mb of code in 5 classes... that sounds like a bit of work... can't imagine what could be in those classes... try to modularize your classes if it is possible and then if the problem persists... dunno :)

          1 Reply Last reply
          0
          • Z Offline
            Z Offline
            Zain
            wrote on last edited by
            #5

            Thanks Raven for quick reply.

            That class files are containing big xml data by which I need to create xml file at specified path into my system at the time of application load.

            Is it any other way by which I can attach my xml files with application setup package and code to copy that xml file to specified path at the time of application load?

            1 Reply Last reply
            0
            • M Offline
              M Offline
              MuldeR
              wrote on last edited by
              #6

              Yes.

              Easiest approach, of course, would be to just ship a separate XML files with your program (binary), e.g. inside a ZIP archive. Alternatively wrap all required files into an installer program, e.g. on Windows use NSIS.

              If you really need to embed files into your program (binary), then have a look at:
              http://qt-project.org/doc/qt-4.8/resources.html

              As said above, the Qt RCC will also generate "large" temporary C++ files, which then need to be compiled to object-code files before they can be linked into the program (binary), but in my experience this works fine. Even with files that have a size of several MB's. I do this regularly with my applications.

              NOTE: As Qt's resource system also can store files compressed, a lot of space might be saved with XML data!

              My OpenSource software at: http://muldersoft.com/

              Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

              Go visit the coop: http://youtu.be/Jay...

              1 Reply Last reply
              0
              • Z Offline
                Z Offline
                Zain
                wrote on last edited by
                #7

                Hey MuldeR Thanks you very much.

                I have added my XMLs to resource file and it is working fine for me.

                Thanks to All.

                1 Reply Last reply
                0
                • B Offline
                  B Offline
                  b1gsnak3
                  wrote on last edited by
                  #8

                  Mark the post as solved thank you :)

                  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