Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用vscode调试如何配置gflags参数? #86

Open
cgeffect opened this issue Dec 5, 2023 · 2 comments
Open

使用vscode调试如何配置gflags参数? #86

cgeffect opened this issue Dec 5, 2023 · 2 comments

Comments

@cgeffect
Copy link

cgeffect commented Dec 5, 2023

使用命令行启动程序, 通过gflags指定参数正常 ./helloworld_svr --config=../conf/trpc_cpp_fiber.yaml
但是如果使用vscode进程调试

示例中HelloWorldServer是继承自TrpcApp, gflags参数

DEFINE_string(config, "trpc_cpp_default.yaml", "trpc cpp framework config file");

默认值是trpc_cpp_default.yaml, 我在程序的运行目录放置一个trpc_cpp_default.yaml文件,运行报错
start server with config, for example: /xxx/build/helloworld_svr --config=default.yaml, 看了代码逻辑

  if (google::GetCommandLineFlagInfo("config", &info) && info.is_default) {
    std::cerr << "start server with config, for example: " << argv[0] << " --config=default.yaml" << std::endl;
    exit(-1);
  }

这里好像又不让使用默认值?

@cgeffect
Copy link
Author

cgeffect commented Dec 5, 2023

把这行代码注释掉
image
重新编译, 在helloworld_svr同级目录放置一个trpc_cpp_default.yaml文件, 执行./helloworld_svr是可以启动成功的

@weimch
Copy link
Contributor

weimch commented Dec 6, 2023

需要配置下vscode启动debug时,传入程序的命令行参数

参见:https://code.visualstudio.com/docs/editor/debugging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants