How to use pjsip in Qt?
Solved
General and Desktop
-
Hi
I built pjsip library with mingw in windows.
I can use it in mingw (pure c++) but i want to add it Qt.The compile output:
15:28:40: Running steps for project appFrameWorkV2... 15:28:40: Configuration unchanged, skipping qmake step. 15:28:40: Starting: "C:\Qt\Qt5.6.0\Tools\mingw492_32\bin\mingw32-make.exe" C:/Qt/Qt5.6.0/Tools/mingw492_32/bin/mingw32-make -f Makefile.Debug mingw32-make[1]: Entering directory 'H:/QtProjects/appFrameWork2-14/build-appFrameWorkV2-Desktop_Qt_5_6_0_MinGW_32bit-Debug' g++ -Wl,-subsystem,windows -mthreads -o debug\appFrameWorkV2.exe debug/main.o debug/message.o debug/qrc_qml.o debug/moc_message.o -lmingw32 -LC:\Qt\Qt5.6.0\5.6\mingw49_32\lib C:\Qt\Qt5.6.0\5.6\mingw49_32\lib\libqtmaind.a -LC:\utils\postgresql\pgsql\lib -LC:\utils\my_sql\my_sql\lib -lshell32 C:\Qt\Qt5.6.0\5.6\mingw49_32\lib\libQt5Quickd.a C:\Qt\Qt5.6.0\5.6\mingw49_32\lib\libQt5Guid.a C:\Qt\Qt5.6.0\5.6\mingw49_32\lib\libQt5Qmld.a C:\Qt\Qt5.6.0\5.6\mingw49_32\lib\libQt5Networkd.a C:\Qt\Qt5.6.0\5.6\mingw49_32\lib\libQt5Cored.a debug/main.o: In function `EpConfig': C:/msys64/usr/local/include/pjsua2/endpoint.hpp:625: undefined reference to `vtable for pj::EpConfig' C:/msys64/usr/local/include/pjsua2/endpoint.hpp:625: undefined reference to `pj::UaConfig::UaConfig()' Makefile.Debug:67: recipe for target 'debug\appFrameWorkV2.exe' failed C:/msys64/usr/local/include/pjsua2/endpoint.hpp:625: undefined reference to `pj::LogConfig::LogConfig()' mingw32-make[1]: Leaving directory 'H:/QtProjects/appFrameWork2-14/build-appFrameWorkV2-Desktop_Qt_5_6_0_MinGW_32bit-Debug' makefile:34: recipe for target 'debug' failed C:/msys64/usr/local/include/pjsua2/endpoint.hpp:625: undefined reference to `pj::MediaConfig::MediaConfig()' debug/main.o: In function `~EpConfig': C:/msys64/usr/local/include/pjsua2/endpoint.hpp:625: undefined reference to `vtable for pj::EpConfig' debug/main.o: In function `~LogConfig': C:/msys64/usr/local/include/pjsua2/endpoint.hpp:343: undefined reference to `vtable for pj::LogConfig' debug/main.o: In function `~UaConfig': C:/msys64/usr/local/include/pjsua2/endpoint.hpp:170: undefined reference to `vtable for pj::UaConfig' debug/main.o: In function `~LogConfig': C:/msys64/usr/local/include/pjsua2/endpoint.hpp:343: undefined reference to `vtable for pj::LogConfig' debug/main.o: In function `ZN2pj8UaConfigD1Ev': C:/msys64/usr/local/include/pjsua2/endpoint.hpp:170: undefined reference to `vtable for pj::UaConfig' debug/main.o: In function `ZN2pj8EpConfigD1Ev': C:/msys64/usr/local/include/pjsua2/endpoint.hpp:625: undefined reference to `vtable for pj::EpConfig' debug/main.o: In function `~LogConfig': C:/msys64/usr/local/include/pjsua2/endpoint.hpp:343: undefined reference to `vtable for pj::LogConfig' debug/main.o: In function `~UaConfig': C:/msys64/usr/local/include/pjsua2/endpoint.hpp:170: undefined reference to `vtable for pj::UaConfig' collect2.exe: error: ld returned 1 exit status mingw32-make[1]: *** [debug\appFrameWorkV2.exe] Error 1 mingw32-make: *** [debug] Error 2 15:28:42: The process "C:\Qt\Qt5.6.0\Tools\mingw492_32\bin\mingw32-make.exe" exited with code 2. Error while building/deploying project appFrameWorkV2 (kit: Desktop Qt 5.6.0 MinGW 32bit) When executing step "Make" 15:28:42: Elapsed time: 00:02.
-
I solved it.
The order is important when adding library.
I share here maybe anybody will used it!
This is my .pro file:TEMPLATE = app QT += qml quick QMAKE_CXXFLAGS += -std=c++11 -lstdc++ -m32 -O2 -fPIC -DPJ_IS_BIG_ENDIAN=0 -DPJ_IS_LITTLE_ENDIAN=1 CONFIG += c++11 -m32 SOURCES += main.cpp \ message.cpp RESOURCES += qml.qrc include(deployment.pri) HEADERS += \ message.h DEFINES -= UNICODE PKGCONFIG = LIBS += -L$$PWD/../../../pjproject-2.5/pj/pjproject-2.5/pjsip/lib/ \ -lpjsua2-i686-pc-mingw32 \ -lstdc++ \ -lpjsua-i686-pc-mingw32 \ -lpjsip-ua-i686-pc-mingw32 \ -lpjsip-simple-i686-pc-mingw32 \ -lpjsip-i686-pc-mingw32 \ -lpjmedia-codec-i686-pc-mingw32 \ -lpjmedia-i686-pc-mingw32 \ -lpjmedia-videodev-i686-pc-mingw32 \ -lpjmedia-audiodev-i686-pc-mingw32 \ -lpjmedia-i686-pc-mingw32 \ -lpjnath-i686-pc-mingw32 \ -lpjlib-util-i686-pc-mingw32 \ -lsrtp-i686-pc-mingw32 \ -lresample-i686-pc-mingw32 \ -lgsmcodec-i686-pc-mingw32 \ -lspeex-i686-pc-mingw32 \ -lilbccodec-i686-pc-mingw32 \ -lg7221codec-i686-pc-mingw32 \ -lpj-i686-pc-mingw32 \ -lm \ -lwinmm \ -lole32 \ -lws2_32 \ -lwsock32 INCLUDEPATH += $$PWD/../../../pjproject-2.5/pj/pjproject-2.5/pjsip/include \ $$PWD/../../../pjproject-2.5/pj/pjproject-2.5/pjlib/include \ $$PWD/../../../pjproject-2.5/pj/pjproject-2.5/pjlib-util/include \ $$PWD/../../../pjproject-2.5/pj/pjproject-2.5/pjmedia/include \ $$PWD/../../../pjproject-2.5/pj/pjproject-2.5/pjnath/include DEPENDPATH += $$PWD/../../../pjproject-2.5/pj/pjproject-2.5/pjsip/include