Qt based lib with MFC/Qt apps



  • Hi everyone,

    I am currently developing a cross platform library (Linux, Win32, MacOSX and android...), which will be used by some Qt and MFC apps (and others but these are the test apps).

    As for now, the library uses standard C++ library but I would like to be able to use Qt Objects in this lib (only non graphical components).

    In windows I use the MSVC10 Toolchain (with sln and vcxproj files), and for Linux/Mac/Android I use the Qt 5.1 Toolchain (with pro files).

    Is there a way to do that without having to compile Qt statically on each platform ?

    thanks for your replys :)


  • Lifetime Qt Champion

    Hi,

    If I'm following you right, you are asking if it is possible to compile only one library working on all platforms ? In that case, no it's not possible.

    Also beware of the licensing implications, see "this":http://blog.qt.digia.com/blog/2009/11/30/qt-making-the-right-licensing-decision/



  • bq. Is there a way to do that without having to compile Qt statically on each platform ?

    Do what? Clarify.

    I undestand ur intention is to have one makefile generator and cross compile for mac, win and linux. The libraries loaded will be mfc in windows (CANNOT be used in linux n mac) and other similar in mac n linux. HOWEVER, i fail to understand, y with a windowing system as cute as qt, u still want to use MFC. And y r u statically building Qt?
    Still, for cross compiling, you can shift to cmake. You can cross compile as shown "here":http://www.cmake.org/Wiki/CMake_Cross_Compiling

    It is preferable though to have a VM and compile it there.



  • thanks for your responses,

    bq. If I’m following you right, you are asking if it is possible to compile only one library working on all platforms ? In that case, no it’s not possible.

    In order to compile my lib on all my platforms I use some VMs which compile the code and commit the result on an svn

    bq. The libraries loaded will be mfc in windows (CANNOT be used in linux n mac) and other similar in mac n linux. HOWEVER, i fail to understand, y with a windowing system as cute as qt, u still want to use MFC. And y r u statically building Qt?

    Old softwares uses MFC and must be able to use the lib as well as new apps which are written with Qt. But I got that covered with two different builds (well two debug and two releases).

    in its current state the lib doesn't have Qt. What I want to know is if there is a way to use Qt in this lib without the need to link the final app to Qt.
    Can I include parts of the Qt Framework in my lib or do I need to put the needed Qt dlls in the subversion directory next to my lib...



  • If you use Qt apis then you need to have qt dlls. The only way to avoid 'showing the world that you have used qt' is to statically link against qt. But for that you will need the commercial version of qt, to do it legally.

    So, yes, you must have qt dlls next to your executable.

    MFC will work only on windows. If any part of your code even touches mfc, you can wish cross platform goodbye(if winelib is ignored). If you have cross compatible code like qt or need to include logic that mac versions include different set of libraries than linux or windows, etc. then go for cmake. It will make cross compiling easier.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.