From 7c5b84d7ef3085828c03fbb55a4ba102519ba0ad Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Thu, 10 Jan 2019 00:10:42 -0800 Subject: [PATCH] Fix the C++ example (#41) - Build with -pthread - Detach the thread to avoid std::thread exception - Remove __RASPBIAN__ check (it's not defined by the on-Pi compiler) --- deps/examples/cpp-multiCameraServer/Makefile | 4 ++-- deps/examples/cpp-multiCameraServer/main.cpp | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/deps/examples/cpp-multiCameraServer/Makefile b/deps/examples/cpp-multiCameraServer/Makefile index b412fa6..2e6efbf 100644 --- a/deps/examples/cpp-multiCameraServer/Makefile +++ b/deps/examples/cpp-multiCameraServer/Makefile @@ -12,7 +12,7 @@ clean: rm ${EXE} *.o ${EXE}: main.o - ${CXX} -o $@ $< -L/usr/local/frc/lib -lcameraserver -lcscore -lntcore -lwpiutil + ${CXX} -pthread -o $@ $< -L/usr/local/frc/lib -lcameraserver -lcscore -lntcore -lwpiutil .cpp.o: - ${CXX} -O -c -o $@ -I/usr/local/frc/include $< + ${CXX} -pthread -O -c -o $@ -I/usr/local/frc/include $< diff --git a/deps/examples/cpp-multiCameraServer/main.cpp b/deps/examples/cpp-multiCameraServer/main.cpp index 3bc73f8..eaab1c2 100644 --- a/deps/examples/cpp-multiCameraServer/main.cpp +++ b/deps/examples/cpp-multiCameraServer/main.cpp @@ -47,11 +47,7 @@ } */ -#ifdef __RASPBIAN__ static const char* configFile = "/boot/frc.json"; -#else -static const char* configFile = "frc.json"; -#endif namespace { @@ -216,7 +212,7 @@ int main(int argc, char* argv[]) { }); */ runner.RunForever(); - }); + }).detach(); } // loop forever