Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22167

How can I optimize my project for the linker in C++ Qt?

$
0
0

I have a project that currently exists of a static library, an executable and a test executable. The two executables link to the static library. The static library contains almost all C++ and header files.

I am using Qt 5.14 and have defined around 3000 Q_PROPERTYs (3000 getter and 3000 setter functions). I have enabled -Wa,-mbig-obj as a compiler options because mocs_compilation.cpp was getting too big to compile. The project is currently compiled for Windows in Mingw with gcc.

My problem currently lies in the slow linking of the project. It takes a very long time for the linker to process the static library.

There are possibilities to switch compilers or linkers, but my interest is currently in the structure of the project. What does the linker like best?

  • A lot of .cpp files and a lot of .o files?
  • Or actually a big single .o file?
  • Will it be faster when I do dynamic linking?
  • Should I split my files into more libraries than just one?

I couldn't really find a source that gives me best practices for such a project.


Viewing all articles
Browse latest Browse all 22167