How to include libWebRTC to C++ Desktop App properly?

626 views
Skip to first unread message

Bertay Eren

unread,
Sep 25, 2023, 11:34:08 AM9/25/23
to discuss-webrtc
Hi everyone,
I've written a WebRTC client example using libwebrtc, my code works fine when I build it with libwebrtc/src/examples but I couldnt managed to run it externally.
Here are the steps I followed:

1- Build libwebrtc and obtain a static webrtc.lib file

2- Set Visual Studio to link the webrtc.lib file

3- Add additional directories:
\webrtc-checkout\src;
\webrtc-checkout\src\third_party\abseil-cpp;
\webrtc-checkout\src\third_party\jsoncpp\source\include;

4-Set preprocesssors:
USE_AURA=1;_HAS_EXCEPTIONS=0;__STD_C;_CRT_RAND_S;_ATL_NO_OPENGL;_WINDOWS;CERT_CHAIN_PARA_HAS_EXTRA_FIELDS;PSAPI_VERSION=2;WIN32;_SECURE_ATL;WINUWP;__WRL_NO_DEFAULT_LIB__;WINAPI_FAMILY=WINAPI_FAMILY_PC_APP;WIN10=_WIN32_WINNT_WIN10;WIN32_LEAN_AND_MEAN;NOMINMAX;_UNICODE;UNICODE;NTDDI_VERSION=NTDDI_WIN10_RS2;_WIN32_WINNT=0x0A00;WINVER=0x0A00;NVALGRIND;DYNAMIC_ANNOTATIONS_ENABLED=0;WEBRTC_ENABLE_PROTOBUF=0;WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE;RTC_ENABLE_VP9;HAVE_SCTP;WEBRTC_LIBRARY_IMPL;WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=0;WEBRTC_WIN;ABSL_ALLOCATOR_NOTHROW=1;_SILENCE_ALL_CXX20_DEPRECATION_WARNINGS;_CRT_SECURE_NO_WARNINGS;_ITERATOR_DEBUG_LEVEL=0

5- Add webrtc.lib library directory to Linker->Additional Library Directories

6- Add additional dependencies to Linker->Input:
webrtc.lib;secur32.lib;winmm.lib;dmoguids.lib;wmcodecdspuuid.lib;msdmo.lib;Strmiids.lib;%(AdditionalDependencies)

But when I try to build, I am receiving approx 600 unresolved external symbol errors mostly realting to webrtc.lib, like rtc::SocketAddress::SetIp and etc.

What am I missing here exactly?

Điền Đô

unread,
Sep 25, 2023, 1:26:22 PM9/25/23
to discuss-webrtc
Hello Bertay Eren
Where did you define the .lib files of "Linker->Input", or did you copy-paste.
I'm also new to webrtc, I used to fix this error by seeing which header file the members causing the error were from.
I would then search for it in the src folder -> then open the corresponding BUILD.gn file containing that folder, and I could find the lib file containing the members causing the error.
This worked for my problem.

Please respond with your results.

Vào lúc 22:34:08 UTC+7 ngày Thứ Hai, 25 tháng 9, 2023, Bertay Eren đã viết:
Reply all
Reply to author
Forward
0 new messages