13

I'm using Visual Studio Code in a basic C++ project. I link a library built with gcc -g option to include the debug symbols information.

However, when I want to step into a function call from that library it doesn't get in. In Visual Studio this How to debug external class library projects in visual studio? would solve the problem but I don't know how to do it in Visual Studio Code. Probably source files for that library should be specified somewhere? But where can I specify them?

paduraru2009
  • 595
  • 2
  • 5
  • 11

3 Answers3

8

Debug => Add Configurations...

This will open a launch.json file. It should look like this:

"version": ...,
"configurations": [
    {

    ... bunch of stuff here

    "justMyCode":false          <==== add this line then save
    }
]

Now you should be able to use breakpoints with external files.

NobodyImportant
  • 167
  • 2
  • 6
1

For those of you who didn't find the launch.json file, you have at least two options:

1 - Create the .vscode/launch.json in your directory by yourself;

2 - After starting the Debug mode, go into the left pane in the 'Run and Debug' tab and then click on the configurations icon. Not sure what's going to be there for other languages, but for python you're gonna have multiple configuration options. The basic one is 'Python File', and after clicking there it's going to create the .vscode/launch.json with a standard configuration already in it. You can click on the 'Add Configuration...' button at the bottom right corner to add more configurations or just write it from scratch by yourself.

I hope it helps...

0

On your launch.json file, specify a path for additionalSOLibSearchPath:

"configurations": [
    {
        "name": "Debug C++",
        "type": "cppdbg",
        ...            
        "additionalSOLibSearchPath": "/path/to/some/dir/from/which/vscode/can/find/the/lib/**"
    },
A.L.
  • 1,133
  • 1
  • 12
  • 19