tencent cloud

Tencent Real-Time Communication

Release Notes and Announcements
Release Notes
Recent Product Announcement
TRTC Live (TUILiveKit) Product Launch Announcement
TRTC Conference Official Editions Launched
The commercial version of Conference is coming soon
Terms and Conditions Applicable to $9.9 Starter Package
Rules for the "First Subscription $100 Discount" Promotion
Announcement on the Start of Beta Testing for Multi-person Audio and Video Conference
TRTC Call Official Editions Launched
License Required for Video Playback in New Version of LiteAV SDK
TRTC to Offer Monthly Packages
Product Introduction
Overview
Concepts
Features
Strengths
Use Cases
Performance Statistics
Tencent RTC Quickplay: Experience Ultimate Real-Time Audio and Video Interaction!
Purchase Guide
Billing Overview
Free Minutes
Monthly subscription
Pay-as-you-go
TRTC Overdue and Suspension Policy
FAQs
Refund Instructions
User Tutorial
Free Demo
Call
Overview
Activate the Service
Run Demo
Integration
Offline Call Push
Conversational Chat
On-Cloud Recording
AI Noise Reduction
UI Customization
Calls integration to Chat
Additional Features
No UI Integration
Server APIs
Client APIs
Solution
ErrorCode
Release Notes
FAQs
Conference
Overview(TUIRoomKit)
Activate the Service (TUIRoomKit)
Run Demo(TUIRoomKit)
Integration(TUIRoomKit)
Screen Sharing (TUIRoomKit)
Schedule a meeting (TUIRoomKit)
In-meeting Call (TUIRoomKit)
UI Customization(TUIRoomKit)
Virtual Background (TUIRoomKit)
Conference Control (TUIRoomKit)
Cloud Recording (TUIRoomKit)
AI Noise Reduction (TUIRoomKit)
In-Conference Chat (TUIRoomKit)
Robot Streaming (TUIRoomKit)
Enhanced Features (TUIRoomKit)
Client APIs (TUIRoomKit)
Server APIs (TUIRoomKit)
FAQs (TUIRoomKit)
Error Code (TUIRoomKit)
SDK Update Log (TUIRoomKit)
Live
Billing of Video Live Component
Overview
Activating the Service (TUILiveKit)
Run Demo
No UI Integration
UI Customization
Live Broadcast Monitoring
Video Live Streaming
Voice Chat Room
Advanced Features
Client APIs
Server APIs
Error Codes
Release Notes
FAQs
RTC Engine
Activate Service
SDK Download
API Examples
Usage Guidelines
API Reference Manual
Advanced Features
AI Integration
Overview
Configure MCP Server
Install Skills
Integration Guide
FAQ
RTC RESTFUL API
History
Introduction
API Category
Room Management APIs
Stream mixing and relay APIs
On-cloud recording APIs
Data Monitoring APIs
Pull stream Relay Related interface
Web Record APIs
AI Service APIs
Cloud Slicing APIs
Cloud Moderation APIs
Making API Requests
Call Quality Monitoring APIs
Usage Statistics APIs
Data Types
Appendix
Error Codes
Console Guide
Application Management
Package Management
Usage Statistics
Monitoring Dashboard
Development Assistance
Solution
Real-Time Chorus
FAQs
Migration Guide
Billing
Features
UserSig
Firewall Restrictions
How to Downsize Installation Package
Android and iOS
Web
Flutter
Electron
TRTCCalling for Web
Audio and Video Quality
Others
Legacy Documentation
RTC RoomEngine SDK(Old)
Integrating TUIRoom (Web)
Integrating TUIRoom (Android)
Integrating TUIRoom (iOS)
Integrating TUIRoom (Flutter)
Integrating TUIRoom (Electron)
TUIRoom APIs
On-Cloud Recording and Playback (Old)
RTC Analytics Monthly Packages (Previous Version)
Protocols and Policies
Compliance
Security White Paper
Notes on Information Security
Service Level Agreement
Apple Privacy Policy: PrivacyInfo.xcprivacy
TRTC Policy
Privacy Policy
Data Processing And Security Agreement
Glossary

Qt

PDF
Focus Mode
Font Size
Last updated: 2024-05-21 15:05:29
This document describes how to quickly integrate the TRTC Windows or macOS SDK into your project using Qt.




Integration for Windows

Development environment requirements

OS: Windows 7 or later
Development environment: Visual Studio 2015 or later (you need to set up a Qt development environment). Visual Studio 2015 is recommended.
Note:
If you are not sure how to set up a Qt development environment in Visual Studio, see step 4 in README.

Directions

The following describes how to integrate the TRTC Windows C++ SDK into a Qt project in Visual Studio.

Step 1. Download the SDK

Download the latest version of the TRTC SDK.
You only need to import the SDK files for Windows C++ in the SDK folder. For example, you can find the SDK files for 64-bit Windows in ./SDK/CPlusPlus/Win64/. The folder contains the following files:
Directory
Description
include
API header files with comments
lib
The LIB file for compilation and DLL files to load

Step 2. Create a project

Take Visual Studio 2015 for example. Make sure you have installed Qt and Qt Visual Studio Add-in. Then, open Visual Studio and create a Qt application named TRTCDemo.

For the example in this guide, Qt Widgets Application is chosen. Click Add, and then click Next in subsequent steps until the project is created.

Step 3. Copy and paste files

Copy the SDK folder to the directory where TRTCDemo.vcxproj is located.
Note:
Because you will only need the C++ SDK, you can delete the CSharp folder in SDK.




Step 4. Modify project configuration

Select Solution Explorer, right-click TRTCDemo, and select Properties. Configure the project as follows:
1. Add include directories. Go C/C++ > General. Add the $(ProjectDir)SDK\\CPlusPlus\\Win64\\include and $(ProjectDir)SDK\\CPlusPlus\\Win64\\include\\TRTC header file directories (for 64-bit Windows) to Additional Include Directories.
Note:
For 32-bit Windows, add $(ProjectDir)SDK\\CPlusPlus\\Win32\\include and $(ProjectDir)SDK\\CPlusPlus\\Win32\\include\\TRTC.



2. Add additional library directories
Go to Linker > General. Add the $(ProjectDir)SDK\\CPlusPlus\\Win64\\lib directory (for 64-bit Windows) to Additional Library Directories.
Note:
For 32-bit Windows, add $(ProjectDir)SDK\\CPlusPlus\\Win32\\lib.



3. Add the library file
Go to Linker > Input, and add the library file liteav.lib to Additional Dependencies.



4. Add the copy command
Go to Build Events > Post-build Events and add the copy command copy /Y $(ProjectDir)SDK\\CPlusPlus\\Win64\\lib\\*.dll $(OutDir) (for 64-bit Windows) to Command Line. This ensures that the DLL files of the SDK are automatically copied to the project’s execution directory after compilation.
Note:
For 32-bit Windows, add copy /Y $(ProjectDir)SDK\\CPlusPlus\\Win32\\lib\\*.dll $(OutDir).




Step 5. Print the SDK version number

1. At the top of the TRTCDemo.cpp file, add the code below to import the header file:
#include "ITRTCCloud.h"
#include <QLabel>
2. In the TRTCDemo::TRTCDemo constructor of TRTCDemo.cpp, add the following testing code:
ITRTCCloud * pTRTCCloud = getTRTCShareInstance();
std::string version(pTRTCCloud->getSDKVersion());

QString sdk_version = QString("SDK Version: %1").arg(version.c_str());
QLabel* label_text = new QLabel(this);
label_text->setAlignment(Qt::AlignCenter);
label_text->resize(this->width(), this->height());
label_text->setText(sdk_version);
3. Press F5 to run the project and print the version number of the SDK.




Integration for macOS

Development environment requirements

OS: OS X 10.10 or later
Development environment: Qt Creator 4.10.3 or later (Qt Creator 4.13.3 or later is recommended.)
Development framework: Qt 5.10 or later

Directions

This section uses a QtTest project as an example to show you how to integrate the TRTC C++ SDK into your project in Qt Creator.

1. Download the cross-platform C++ SDK
1.1 Download the SDK, and decompress and open the file.
1.2 Create an empty folder for the SDK in the same directory as your QtTest project, and copy TXLiteAVSDKTRTCMacx.x.x/SDK/TXLiteAVSDKTRTC_Mac.framework to the folder.
2. Configure QTTest.pro Go to the directory of your QtTest project, open QTTest.pro with a text editor, and add the following SDK references.
INCLUDEPATH += $$PWD/.
DEPENDPATH += $$PWD/.

LIBS += "-F$$PWD/base/util/mac/usersig"
LIBS += "-F$$PWD/../SDK"
LIBS += -framework TXLiteAVSDK_TRTC_Mac
LIBS += -framework Accelerate
LIBS += -framework AudioUnit

INCLUDEPATH += $$PWD/../SDK/TXLiteAVSDK_TRTC_Mac.framework/Headers/cpp_interface

INCLUDEPATH += $$PWD/base/util/mac/usersig/include
DEPENDPATH += $$PWD/base/util/mac/usersig/include
3. Grant camera and mic permissions The TRTC SDK will use the device’s camera and mic, so you need to add permission requests to Info.plist.
NSMicrophoneUsageDescription: requesting mic access
NSCameraUsageDescription: requesting camera access
As shown below:


4. Reference the TRTC SDK
Reference the SDK via the header file: #include "ITRTCCloud.h".
Use the namespace: The methods and types of cross-platform C++ APIs are all defined in the trtc namespace. To simplify your code, we recommend you use the trtc namespace.
Note:
This concludes the integration process, and you can proceed to compile your project. You can download QTDemo to get more information on the use of cross-platform APIs of the SDK.

FAQs

If the following error occurs, check whether the SDK header file directories are correctly added as described in the project configuration step above.
fatal error C1083: Could not open include file: “TRTCCloud.h”: No such file or directory
If the following error occurs, check whether the SDK library directory and library file are correctly added as described in the project configuration step above.
error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class TXString __cdecl TRTCCloud::getSDKVersion(void)" (__imp_?getSDKVersion@TRTCCloud@@SA?AVTXString@@XZ), referenced in function "protected: virtual int __thiscall CTRTCDemoDlg::OnInitDialog(void)" (?OnInitDialog@CTRTCDemoDlg@@MAEHXZ)


Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback