Visual Studio 2017 CMake项目没有调试符号

时间:2017-11-06 21:11:29

标签: c++ cmake visual-studio-2017

使用VS2017中对CMake的内置支持,无法调试VS2017内的应用程序:

  

模块编译时没有符号

项目配置设置为x64-Debug:

的main.cpp

#include <iostream>

int main()
{
    std::cout << "Hello!" << std::endl; // breakpoint set here is ignored
}

的CMakeLists.txt

cmake_minimum_required(VERSION 3.8)

project (FuelTrip)

add_executable(Main main.cpp)

launch.vs,JSON

{
  "configurations": [
    {
      "name": "${buildRoot}\\Main.exe",
      "project": "CMakeLists.txt",
      "projectTarget": "${buildRoot}\\Main.exe",
      "type": "debug"
    }
  ],
  "defaults": {},
  "version": "0.2.1"
}

配置输出:

命令行:C:\ PROGRAM FILES(X86)\ MICROSOFT VISUAL STUDIO \ 2017 \ ENTERPRISE \ COMMON7 \ IDE \ COMMONEXTENSIONS \ MICROSOFT \ CMAKE \ CMake \ bin \ cmake.exe -G&#34; Ninja&#34; -DCMAKE_INSTALL_PREFIX:PATH =&#34; C:\用户\ Amadeusz \ CMakeBuilds \ 994008b2-a9d0-383b-b166-558e527025e3 \安装\ x64的调试&#34; -DCMAKE_BUILD_TYPE =&#34;调试和#34; -DCMAKE_MAKE_PROGRAM =&#34; C:\ PROGRAM FILES(X86)\ MICROSOFT VISUAL STUDIO \ 2017 \ ENTERPRISE \ COMMON7 \ IDE \ COMMONEXTENSIONS \ MICROSOFT \ CMAKE \ Ninja \ ninja.exe&#34; &#34; d:\ @ Projekty @ \其它\ FuelTrip&#34;

编译输出:

[1/2] C:\ MinGW \ bin \ c ++。exe -g -MD -MT CMakeFiles / Main.dir / main.cpp.obj -MF CMakeFiles \ Main.dir \ main.cpp.obj.d -o CMakeFiles / Main.dir / main.cpp.obj -c D:/ @ Projekty@/Others/FuelTrip/main.cpp   [2/2] cmd.exe / C&#34; cd。 &安培;&安培; C:\ MinGW \ bin \ c ++。exe -g CMakeFiles / Main.dir / main.cpp.obj -o Main.exe -Wl, - out-implib,libMain.dll.a -Wl, - major-image -version,0, - minor-image-version,0 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32&amp;&amp; cd。&#34;

有人有过类似的问题吗?

0 个答案:

没有答案