VS Qt - cmake项目中添加运行时命令行参数

1、VS

在项目目录中找到.vs目录--->launch.vs.json

{
  "version": "0.2.1",
  "defaults": {},
  "configurations": [
    {
      "type": "default",
      "project": "CMakeLists.txt",
      "projectTarget": "app.exe (src\\app.exe)",
      "name": "app.exe (src\\app.exe)",
      "args": [
        "-XXX"  //此处为运行时传入的命令行参数为 -XXX
      ]
    },
    {
      "type": "default",
      "project": "CMakeLists.txt",
      "projectTarget": "",
      "name": "CMakeLists.txt"
    }
  ]
}

2、Qt

打开Qt项目--->选择左侧边栏中项目--->选择运行--->在Command line arguments栏中添加需要传入的命令行参数即可(如下图红框)

 

posted @ 2024-02-28 18:13  Citrusliu  阅读(242)  评论(0编辑  收藏  举报