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

Including protobuf to Qt



  • Re: Problem including Protobuf v3.12.4 with Qt creator

    I have built protobuf 3.12.4 and generated libraries out of it by configuring using "cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_BUILD_TYPE=Release -Dprotobuf_WITH_ZLIB=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF -DCMAKE_INSTALL_PREFIX=../../../../install ../.."

    After this I built the code using Visual Studio 2019, which generated libraries and binaries.
    I used protoc and generated .cc and .h files and included them in my pro file. I added all .libs generated to my application and to my .pro file -

    win32: LIBS += -L$$PWD/3rdparty/protobuf/lib/win/ -llibprotobuf
    win32: LIBS += -L$$PWD/3rdparty/protobuf/lib/win/ -llibprotoc
    win32: LIBS += -L$$PWD/3rdparty/protobuf/lib/win/ -llibprotobuf-lite

    I am getting following errors while linking:
    qtmain.lib(qtmain_win.obj):-1: error: LNK2019: unresolved external symbol main referenced in function WinMain
    win32-build\bin\release\test.exe:-1: error: LNK1120: 1 unresolved externals

    Any idea what I did wrong. I am clueless. I am suspecting if protobuf main function is getting conflict with Qt main function. Appreciate your suggestions and help. Thanks



  • @SGaist Any suggestions? I feel I have missed something very basic. I saw your replies over other protobuf threads so tagging you. Hope it's not against code of conduct. Thanks



  • @Ryna said in Including protobuf to Qt:

    conflict with Qt main function

    How did you got Qt installed/deployed in your machine? Are you sure Qt was also built with MS VS201x?


Log in to reply