Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

CoCreateInstance() in Qt5.9



  • Recently I needed to use mx-component to write/read PLC(the interface is implemented with Qt.)

    After I finish the code, it come across one error.(Qt5.9 - Kit MSVC 2017 + Windows10)

    I tried to delete the Build-..-Debug folder, but no use.

    It's a question of lib? I don't know. The whole Qt project is below here, it's a tiny project.

    CoCreateInstance() is located in file plc_widget.cpp - line 49.

    Please note that I include the mx-component files in project, and the files is located in my own local PC, so if you run it directly,...will get more than one error.

    https://pan.baidu.com/s/1ciNTfzrYs9e4o5vDu3v_cw


  • Lifetime Qt Champion

    hi @Limer,

    it's a linker error, so either you don't link against the lib containing this symbol or the linker cannot find the lib file.

    edit: it's ole32.lib, try adding LIBS += ole32 to your .pro file



  • Success! Thanks.


Log in to reply