내 프로젝트에서 사용하기 위해 cmake를 사용하여 WebRTC 예제에서 피어 연결 클라이언트를 구축하려고합니다.WebRTC가 정의되지 않은 참조
나는 모든 WebRTC에 라이브러리를 포함 시켰 등을 구축 할 수 있지만, 필자는 항상 동일한 문제가 점점 :
CMakeFiles/webrtcbridge_node.dir/src/webrtcbridge_node.cc.o:(.rodata._ZTI18CustomSocketServer[_ZTI18CustomSocketServer]+0x10): undefined reference to `typeinfo for rtc::PhysicalSocketServer'
CMakeFiles/webrtcbridge_node.dir/src/conductor.cc.o: In function `Conductor::OnMessageFromPeer(int, std::string const&)':
conductor.cc:(.text+0x294d): undefined reference to `rtc::GetStringFromJsonObject(Json::Value const&, std::string const&, std::string*)'
conductor.cc:(.text+0x2aed): undefined reference to `rtc::GetStringFromJsonObject(Json::Value const&, std::string const&, std::string*)'
conductor.cc:(.text+0x2c01): undefined reference to `webrtc::CreateSessionDescription(std::string const&, std::string const&, webrtc::SdpParseError*)'
conductor.cc:(.text+0x2f46): undefined reference to `rtc::GetStringFromJsonObject(Json::Value const&, std::string const&, std::string*)'
conductor.cc:(.text+0x2fa7): undefined reference to `rtc::GetIntFromJsonObject(Json::Value const&, std::string const&, int*)'
conductor.cc:(.text+0x3004): undefined reference to `rtc::GetStringFromJsonObject(Json::Value const&, std::string const&, std::string*)'
conductor.cc:(.text+0x3190): undefined reference to `webrtc::CreateIceCandidate(std::string const&, int, std::string const&, webrtc::SdpParseError*)'
CMakeFiles/webrtcbridge_node.dir/src/conductor.cc.o: In function `Conductor::OnSuccess(webrtc::SessionDescriptionInterface*)':
conductor.cc:(.text+0x53e9): undefined reference to `webrtc::CreateSessionDescription(std::string const&, std::string const&, webrtc::SdpParseError*)'
CMakeFiles/webrtcbridge_node.dir/src/conductor.cc.o: In function `rtc::ArrayView<int, -4711l>::ArrayView<int>(int*, unsigned long)':
conductor.cc:(.text._ZN3rtc9ArrayViewIiLln4711EEC2IiEEPT_m[_ZN3rtc9ArrayViewIiLln4711EEC5IiEEPT_m]+0xd4): undefined reference to `rtc::FatalMessage::FatalMessage(char const*, int, std::string*)'
conductor.cc:(.text._ZN3rtc9ArrayViewIiLln4711EEC2IiEEPT_m[_ZN3rtc9ArrayViewIiLln4711EEC5IiEEPT_m]+0x15a): undefined reference to `rtc::FatalMessage::FatalMessage(char const*, int, std::string*)'
conductor.cc:(.text._ZN3rtc9ArrayViewIiLln4711EEC2IiEEPT_m[_ZN3rtc9ArrayViewIiLln4711EEC5IiEEPT_m]+0x200): undefined reference to `rtc::FatalMessage::FatalMessage(char const*, int, std::string*)'
CMakeFiles/webrtcbridge_node.dir/src/conductor.cc.o: In function `rtc::ArrayView<rtc::IntervalRange, -4711l>::ArrayView<rtc::IntervalRange>(rtc::IntervalRange*, unsigned long)':
conductor.cc:(.text._ZN3rtc9ArrayViewINS_13IntervalRangeELln4711EEC2IS1_EEPT_m[_ZN3rtc9ArrayViewINS_13IntervalRangeELln4711EEC5IS1_EEPT_m]+0xd4): undefined reference to `rtc::FatalMessage::FatalMessage(char const*, int, std::string*)'
conductor.cc:(.text._ZN3rtc9ArrayViewINS_13IntervalRangeELln4711EEC2IS1_EEPT_m[_ZN3rtc9ArrayViewINS_13IntervalRangeELln4711EEC5IS1_EEPT_m]+0x15a): undefined reference to `rtc::FatalMessage::FatalMessage(char const*, int, std::string*)'
CMakeFiles/webrtcbridge_node.dir/src/conductor.cc.o:conductor.cc:(.text._ZN3rtc9ArrayViewINS_13IntervalRangeELln4711EEC2IS1_EEPT_m[_ZN3rtc9ArrayViewINS_13IntervalRangeELln4711EEC5IS1_EEPT_m]+0x200): more undefined references `rtc::FatalMessage::FatalMessage(char const*, int, std::string*)'
CMakeFiles/webrtcbridge_node.dir/src/conductor.cc.o: In function `std::string* rtc::CheckEqImpl<unsigned long, unsigned long>(unsigned long const&, unsigned long const&, char const*)':
conductor.cc:(.text._ZN3rtc11CheckEqImplImmEEPSsRKT_RKT0_PKc[_ZN3rtc11CheckEqImplImmEEPSsRKT_RKT0_PKc]+0x4b): undefined reference to `std::string* rtc::MakeCheckOpString<unsigned long, unsigned long>(unsigned long const&, unsigned long const&, char const*)'
CMakeFiles/webrtcbridge_node.dir/src/peer_connection_client.cc.o: In function `PeerConnectionClient::Connect(std::string const&, int, std::string const&)':
peer_connection_client.cc:(.text+0xc97): undefined reference to `rtc::SocketAddress::SetIP(std::string const&)'
CMakeFiles/webrtcbridge_node.dir/src/peer_connection_client.cc.o:(.rodata._ZTI20PeerConnectionClient[_ZTI20PeerConnectionClient]+0x28): undefined reference to `typeinfo for rtc::MessageHandler'
collect2: error: ld returned 1 exit status
webrtcbridge/CMakeFiles/webrtcbridge_node.dir/build.make:205: recipe for target 'webrtcbridge/webrtcbridge_node' failed
make[2]: *** [webrtcbridge/webrtcbridge_node] Error 1
CMakeFiles/Makefile2:878: recipe for target 'webrtcbridge/CMakeFiles/webrtcbridge_node.dir/all' failed
make[1]: *** [webrtcbridge/CMakeFiles/webrtcbridge_node.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j2 -l2" failed
를이 내 CMakeLists.txt
cmake_minimum_required(VERSION 3.3)
project(webrtcbridge)
add_compile_options(-std=c++11)
#Include PkgConfig to detect GTK+ headers/library files
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
pkg_check_modules(JSONCPP REQUIRED jsoncpp)
include_directories(${GTK3_INCLUDE_DIRS})
link_directories(${GTK3_LIBRARY_DIRS})
set(LIBYUV_LIBRARY_DIRS "/home/carlos/webrtc/webrtc-checkout/src/out/Release/obj/third_party/libyuv")
set(LIBYUV_INCLUDE_DIRS "/home/carlos/webrtc/webrtc-checkout/src/third_party/libyuv/include")
set(LIBWEBRTC_INCLUDE_DIRS "/home/carlos/webrtc/webrtc-checkout/src")
set(LIBWEBRTC_LIBRARY_DIRS "/home/carlos/webrtc/webrtc-checkout/src/out/Release/obj")
include_directories(${LIBWEBRTC_INCLUDE_DIRS})
link_directories(${LIBWEBRTC_LIBRARY_DIRS})
include_directories(${JSONCPP_INCLUDE_DIRS})
link_directories(${JSONCPP_LIBRARY_DIRS})
include_directories(${LIBYUV_INCLUDE_DIRS})
link_directories(${LIBYUV_LIBRARY_DIRS})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWEBRTC_POSIX -D_GLIBCXX_USE_CXX11_ABI=0 -std=gnu++0x -pthread")
#[[ Included Libraries
- LibWebRTC
- LibWebRTC_Common
- LibX11
- LibICE
- LibSM
- LibXext
- Libdl
- Librt
- LibJsoncpp
]]
set(LIBWEBRTC_LIBRARIES /home/carlos/webrtc/webrtc-checkout/src/out/Release/obj/webrtc/libwebrtc.a;/home/carlos/webrtc/webrtc-checkout/src/out/Release/obj/webrtc/libwebrtc_common.a;/usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libICE.so;/usr/lib/x86_64-linux-gnu/libSM.so;/usr/lib/x86_64-linux-gnu/libXext.so;dl;rt;/home/carlos/webrtc/webrtc-checkout/src/build/linux/debian_jessie_amd64-sysroot/usr/lib/libjsoncpp.a)
file(GLOB SOURCES src/*.cc)
add_executable(${PROJECT_NAME}_node
${SOURCES}
)
# WebRTC Libraries
target_link_libraries(${PROJECT_NAME}_node
${LIBWEBRTC_LIBRARIES}
)
# GTK libraries
target_link_libraries(${PROJECT_NAME}_node
${GTK3_LIBRARIES}
)
# JSONCPP libraries
target_link_libraries(${PROJECT_NAME}_node
${JSONCPP_LIBRARIES}
)
입니다 그것은 문제가 보인다 Json 라이브러리가 있지만 코드를 체크인 할 수 있으므로 이미 포함되어 있습니다.
반면 내부 json 라이브러리에는 문제가있을 수 있지만 libwebrtc.a에 포함될 예정이므로 문제가 될 수 있습니다.
감사