简体   繁体   中英

Visual Studio 2017 Debugger Not Working - Attach to Process appears

I'm a new learner of C++ and just downloaded Visual Studio 2017 last week.

I'm trying to run a simple function on Visual Studio but can't seem to get Debugging to run. When I pressed on the green arrow for debugging, Attach to Process appeared. There is no MSVSMON.EXE option under the Connection Target: [my laptop id] and no other option when I switched Connection type to Default. I couldn't find an option for MSVSMON.EXE to be downloaded separately online. Attach to Process Window In Debug options, it showed that Start Debugging is grey out. Solution Configurations and Solution Platforms are empty and can't be changed. Debug Window I'm using Visual Studio 2017 to learn OpenFrameworks but ran into the trouble above. I tried running the same code in Visual Studio Code and it debugged like normal but I need the 2017 version for a class. The example I'm running in the .cpp file is the followings:

//TEAM 1:
# include <iostream>
using namespace std; 
int main() {
    for (int x = 0; x <= 9; x++) {
        cout << "forward " + x << endl;
    }

    for (int x = 9; x >= 0; x--) {
        cout << "backward" + x << endl;
    }

    cout << "hello!" << endl;

}

Thank you for your help!

I tried running the same code in Visual Studio Code and it debugged like normal but I need the 2017 version for a class.

First, please check whether you have opened a solution or a project rather than a cpp file. In general, all the debug configuration info are stored in the xxxx.vcxproj file and .vs hidden folder which belog to the whole project.

Solution

First , try to click File --> Open --> Porject/Solution to open .sln or xxx.vcxproj file. Besides , right-click on the project which you want to debug to click Set as StartUp Project .

Note : each project can only has one main cpp file. Or you can just add these codes into the main cpp file directly.

If the steps above did not work, please try these:

1) exclude this project from your solution(remove it) and then build your solution without it.

2) you should again add your project into the current solution and then build your solution and set it as Start Up Application.

In addition, if you cretae the OpenFrameworks project with other third party tool to generate it and then open the project in VS2017, I think you cannot do this. Incompatibilities and other issues can arise because the project itself generated by other tools is not the same as the project structure created by VS2017.

So try these steps to create OpenFrameworks projects with VS2017:

1) install openFrameworks extension on Tools --> Extension and Updates .

2) After that, when you create the openFrameworks project in VS2017, do not forget to add the folder path of of_v0.11.0_vs2017_release which is downloaded from this link .

You can follow this guidance to get more detailed steps.

在此处输入图片说明

3) After that, you can try to add these codes in main.cpp file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM