0

Is is necessary to use the Qt toolchain (pro files, qmake, etc...) in order to link against a library that was implemented and built with Qt, but itself exposes only a C style API? None of the Qt specific classes are used in the library.

The question applies to both static and dynamic libraries.

IvanB
  • 115
  • 8
  • 1
    I would think not. Why don't you try without Qt toolchain? You can check dependencies. Look at http://stackoverflow.com/questions/6242761/how-do-i-find-the-direct-shared-object-dependencies-of-a-linux-elf-binary. – user2672165 Nov 21 '15 at 13:52
  • As long as you have all the dependencies (i.e. the Qt-DLLs) it should work – Felix Nov 21 '15 at 17:22

1 Answers1

0

Is is necessary to use the Qt tools in order to link against a library that was implemented with Qt.

Absolutely not.


The Qt tools that generate code are moc and rcc; if your API doesn't use this then it is quite possible just to use normal 'C' tools.

moc is a tool for signals and slots and even C++ code doesn't need to use the Qt tools to link against a Qt library. You can scan a 'header' for the MOC macro with grep, etc in a make rule to know if the moc program should be run on the executable. Following a convention that class.cc has a declaration in class.h makes this easy.

rcc is a feature that bundle resources with an application. However this would be for the Qt application/library and in your case, you just want to link with it.

So, it is even possible to make Qt applications/libraries without qmake, etc. However, your makefile will need to fulfil all the portability issues that qmake, etc do or you may not care about this.

There are trade-offs to not using the Qt tools. However, a large majority of Qt features can be used without the tools.

artless noise
  • 21,212
  • 6
  • 68
  • 105