Please nominate your Qt Champions for 2021!

Integration generated library from Visual Studio

  • Hello,

    I generate a exe file in Visual Studio and it also generates the lib file.

    I want to use that lib file into QtCreator . So I made that pro file :

    ######### LIBRARY
    LIBS += -LC:\Users\seniordev\Desktop\Developpement\bin\win64\Release\ -lMyLib
    INCLUDEPATH += $$PWD/../../BGE
    DEPENDPATH += $$PWD/../../BGE
    PRE_TARGETDEPS += C:\Users\seniordev\Desktop\Developpement\bin\win64\Release\MyLib.lib

    But I get that error , it seems the library is not detected:

    main.obj:-1: error: LNK2019: unresolved external symbol "public: __cdecl Parametermanager::~Parametermanager(void)" (??1Parametermanager@@QEAA@XZ) referenced in function main

    The ParameterManager is a object of MyLib.lib.

  • Lifetime Qt Champion

    @Xav12358 Do you use the same compiler in QtCreator as you used to create the library?

  • I made a mistake during my library generation. Now I get that in QTCreator:

    error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.obj

  • Lifetime Qt Champion


    That means that you are trying to link a library built with the static VS runtime with one using the dynamic runtime. You should ensure all your libraries link to the same runtime. In this case the dynamic runtime otherwise you'll have to rebuild Qt yourself.

Log in to reply