Skip to content

Commit

Permalink
Fix the C++ example (#41)
Browse files Browse the repository at this point in the history
- Build with -pthread
- Detach the thread to avoid std::thread exception
- Remove __RASPBIAN__ check (it's not defined by the on-Pi compiler)
  • Loading branch information
PeterJohnson authored Jan 10, 2019
1 parent ddbf6b4 commit 7c5b84d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 2 additions & 2 deletions deps/examples/cpp-multiCameraServer/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 $<
6 changes: 1 addition & 5 deletions deps/examples/cpp-multiCameraServer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,7 @@
}
*/

#ifdef __RASPBIAN__
static const char* configFile = "/boot/frc.json";
#else
static const char* configFile = "frc.json";
#endif

namespace {

Expand Down Expand Up @@ -216,7 +212,7 @@ int main(int argc, char* argv[]) {
});
*/
runner.RunForever();
});
}).detach();
}

// loop forever
Expand Down

0 comments on commit 7c5b84d

Please sign in to comment.