我正在将CMake
用于一个C++
项目。我正在尝试使用profile guided optimization
,因此还需要将命令行参数传递给二进制文件的Release
模式版本。 Visual Studio
需要使用它来创建性能配置文件。我已经为launch.vs.json
模式二进制文件提供了Debug
配置,并带有命令行参数:
{
"version": "0.2.1",
"defaults": {},
"configurations": [
{
"name": "MyProject",
"project": "CMakeLists.txt",
"projectTarget": "MyProject.exe",
"type": "default",
"args": [
"...", "..."
]
}
]
}
当我切换到Release
模式并选择MyProject
启动项时,Visual Studio
显示以下错误消息:
Unable to start debugging. The startup project could not be launched.
为什么它不能那样工作?我也无法设置其他配置文件并使Visual Studio
在Release
模式下能够识别它,但是在Debug
模式下它可以正常工作。
答案 0 :(得分:0)
我现在设法通过添加另一个条目来做到这一点:
{
"version": "0.2.1",
"defaults": {},
"configurations": [
{
"name": "MyProject",
"project": "CMakeLists.txt",
"projectTarget": "MyProject.exe",
"type": "default",
"args": ["...", "..."]
},
{
"name": "MyProject (Release\\MyProject.exe)",
"project": "CMakeLists.txt",
"projectTarget": "MyProject.exe (Release\\MyProject.exe)",
"type": "default",
"args": ["...", "..."]
}
]
}