I am working on Qt/QML/C++ based Client-Server software system with custom protocol. Now, in both projects inside QtCreator I have same header and implementation files inside both projects.

What is the best way to eliminate duplicated files, or, if I put custom communication protocol inside library, is this the right path, or are there maybe some other/better solutions?

  • 2
    put common code in a library. That's what libraries are there for.
    – gbjbaanb
    Commented Mar 29, 2016 at 9:50
  • 1
    Is the custom communications protocol a requirement or are you just writing a custom protocol to solve a problem? You might want to look at existing communication mechanisms to make sure you aren't re-inventing the wheel: stackoverflow.com/questions/118945/best-c-c-network-library Commented Mar 29, 2016 at 14:34
  • @BenCottrell thank you for your link, I've been already using Qt, what I want now to establish simple TCP/UDP socket communication between my applications. Commented Mar 29, 2016 at 15:01

1 Answer 1


Like @bbjbaand said, I did put common code inside dedicated library, works perfectly!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.