Before integrating the ZEGO Express SDK, make sure the development environment meets the following requirements:
yum install alsa-lib-devel libv4l-devel
command.apt install libasound2-dev libv4l-dev
command.When using Qt + qmake to integrate the SDK, the version of the Qt you use must be 5.9 - 5.15. For more details, refer to Getting Started with Qt.
Download the latest version of the SDK. For more details, see SDK downloads.
Extract files from the downloaded SDK package, and copy the files under the release/Library
directory to your project.
When using CMake to integrate the SDK, import the SDK as follows:
Import the SDK in the CMakeLists.txt
file of your project.
cmake_minimum_required(VERSION 3.7)
project(MyAwesomeProject)
# Add header search path
include_directories("./libs/zego/include")
# Add lib search path
link_directories("./libs/zego")
# Link SDK
link_libraries(ZegoExpressEngine rt)
add_compile_options(
-std=c++11
)
aux_source_directory(./src SRC_LIST)
add_executable(MyAwesomeProject ${SRC_LIST})
When using Qt + qmake to integrate the SDK, import the SDK as follows:
Add the following to the <project_name>.pro
file of your project to import the SDK library and header file.
unix {
contains(QT_ARCH, arm64) {
INCLUDEPATH += $$PWD/../libs/ZegoExpress/linux/aarch64/include
DEPENDPATH += $$PWD/../libs/ZegoExpress/linux/aarch64/include
LIBS += -L$$PWD/../libs/ZegoExpress/linux/aarch64 -lZegoExpressEngine
} else:contains(QT_ARCH, arm) {
INCLUDEPATH += $$PWD/../libs/ZegoExpress/linux/armhf/include
DEPENDPATH += $$PWD/../libs/ZegoExpress/linux/armhf/include
LIBS += -L$$PWD/../libs/ZegoExpress/linux/armhf -lZegoExpressEngine
} else { # Assume other archs are x86_64
INCLUDEPATH += $$PWD/../libs/ZegoExpress/linux/x86_64/include
DEPENDPATH += $$PWD/../libs/ZegoExpress/linux/x86_64/include
LIBS += -L$$PWD/../libs/ZegoExpress/linux/x86_64 -lZegoExpressEngine
}
}
(Optional) The Linux SDK on the client side does not block the SIGPIPE signal. Developers need to decide whether to block the SIGPIPE signal based on the actual situation during the development process.
In most cases, you need to block this signal, otherwise the client process will exit by default after receiving this signal. Alternatively, you can simply ignore this signal: signal(SIGPIPE,SIG_IGN);
.
static void ExceptionSigHandler(int signum)
{
char exitSignalStr[1024] = {0};
sprintf(exitSignalStr,"exception signal : %d",signum);
log("------------------------------");
log(exitSignalStr);
log("------------------------------");
}
int main(int argc, const char * argv[]) {
signal(SIGPIPE, ExceptionSigHandler);
// your code
return 0;
}