brpc icon indicating copy to clipboard operation
brpc copied to clipboard

用brpc的flag v会提示引用找不到

Open sherlock-wong opened this issue 1 year ago • 5 comments

Describe the bug (描述bug) 在其他的文件中DECLARE_int32(v); 但是用的时候会提示找不到引用,在cmake里已经link了brpc和gflag

To Reproduce (复现方法)

Expected behavior (期望行为)

Versions (各种版本) OS: Compiler: brpc: protobuf:

Additional context/screenshots (更多上下文/截图) image

image image

sherlock-wong avatar Apr 11 '24 09:04 sherlock-wong

加上namespace logging试试:

namespace logging {
DECLARE_int32(v);
}

chenBright avatar Apr 11 '24 09:04 chenBright

加上namespace logging试试:

namespace logging {
DECLARE_int32(v);
}

多谢你的意见, 不过这种方式也读不到相应的值

sherlock-wong avatar Apr 12 '24 06:04 sherlock-wong

读不到命令行的值吗?调用了 gflags::ParseCommandLineFlags(&argc, &argv, true);吗? 详细使用方法参考gflag文档:https://gflags.github.io/gflags/#together

chenBright avatar Apr 12 '24 07:04 chenBright

读不到命令行的值吗?调用了 gflags::ParseCommandLineFlags(&argc, &argv, true);吗? 详细使用方法参考gflag文档:https://gflags.github.io/gflags/#together image 在main函数就已经调用了的

sherlock-wong avatar Apr 12 '24 09:04 sherlock-wong

那现在是什么问题?

chenBright avatar Apr 12 '24 09:04 chenBright