Solved Problem in Compiling 3MB size class(.cpp) in GUI Application
-
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 -
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.
-
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...
-
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?
-
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.htmlAs 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!