Ива*_*ван 6 c++ pthreads protocol-buffers
需要在没有pthread的实时操作系统上使用Protocol Buffers.我可以通过这种方式静态链接protobuf
g++ -g -Wall example.pb.cc example.cc -o example -static -lprotobuf -lpthread
Run Code Online (Sandbox Code Playgroud)
但是如果没有pthread,我会收到链接错误.是否可以配置protobuf在没有pthread的情况下工作?
并不是的.请参阅此未解决的问题.
有人修补了一个较旧的protobuf版本,不依赖于pthreads,请看这里 - 你可能会看看你是否真的需要它,并可能转发端口.
另请注意,在使用protobuf时,您应该使用pkg_config来获取正确的编译器和链接器标志,例如
pkg-config --cflags protobuf # compiler flags
pkg-config --libs protobuf # linker flags
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1075 次 |
| 最近记录: |