1

I am trying out Targeting the Windows Subsystem for Linux from Visual Studio. The project builds fine in Visual Studio:

1>------ Rebuild All started: Project: LinuxConsoleApp, Configuration: Debug x64 ------
1>Cleaning remote project directory
1>Validating architecture
1>Validating sources
1>Copying sources remotely to 'localhost'
1>Starting remote build
1>Compiling sources:
1>main.cpp
1>Linking objects
1>LinuxConsoleApp.vcxproj -> C:\...\LinuxConsoleApp\bin\x64\Debug\LinuxConsoleApp.out
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

I can run it from the bash commandline prompt on Windows:

linux@windows-bash:/mnt/c/.../LinuxConsoleApp/bin/x64/Debug$ ./LinuxConsoleApp.out
hello from LinuxConsoleApp!

However, when I set a breakpoint to debug it from Visual Studio, I got error:

"Could not launch gdb. gdb is missing from your system and needs to be installed, please use your system's package manager to install it"

I did install gdbserver on the Linux subsystem on Windows. Does anyone know what else I need to make it work? Thanks in advance!

1
  • Start the SSH service and don't close the CMD windows. Commented Jun 17, 2018 at 18:14

1 Answer 1

6

Firstly, have you installed gdb on WSL? What does command gdb --version display?

Then recommend you debug in gdb mode, see this topic for details.

And, if you read the comments in the original Visual Studio blog about using WSL, you will see that there are some issues around ssh which, if you follow the trail, will take you to this fix

Sign up to request clarification or add additional context in comments.

1 Comment

Yup, running 'sudo apt-get install gdb' to install gdb on WSL fixes it. Thank you for the nice reply!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.