Qt World Summit: Register Today!

Integrating a library .lib

  • Hello,

    I am using Qt to design a desktop interface. I want to integrate a .lib that I have already built using Visual Studio.
    However I get LNK1257: code generation failed. This is surely because my visual studio library used VC++ compiler and Qt uses GCC.

    What would be my best options ? (for instance: transfer the code from my library directly in Qt, compile my library with GCC instead, anything else ?)

    Thank you so much,


  • @alecs26

    It merely depends on the age of your Visual Studio. For newer versions you can get also precompiled Qt libs. For older version you may have to compile Qt libs yourself.

    You can use also the VS compilers from Qt creator.

    If you prefer to continue with GCC and Qt libs you need to recompile your libs with GCC.

    My personal chioce is the last one. I have changed a while ago from VS to MinGW on windows. However, the decision is with you.

  • Perfect, thank you.
    I think I will try to import everything in Qt with GCC. It will also be easier to update and keep running in the future instead of having to manage the .lib with VStudio and the rest with Qt.

    Thank you !


  • @alecs26

    The problem with VS is that you have to recompile for sure every time with a new compiler version. The VS compilers are only compatible as long as you stay within the same version e.g. VS2015.

    Note: Qt libs are the GUI framework and some additional stuff. This is often called simply Qt.
    Qt creator is simply an IDE which uses also Qt libs, but may be used also for other projects. In case you like to port to linux for instance the use Qt creator becomes handy. You do not need to learn another IDE.

Log in to reply