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
    Mar 29 '16 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 Mar 29 '16 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. Mar 29 '16 at 15:01

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, privacy policy and cookie policy

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