Skip to content

it goes to declaration instead of definition #3378

@Lennon925

Description

@Lennon925

Type: LanguageService

Describe the bug

  • OS and Version:
  • VS Code Version: 1.31.1
  • C/C++ Extension Version: 0.21
  • Other extensions you installed (and if the issue persists after disabling them):
  • A clear and concise description of what the bug is.

To Reproduce

  1. I add two folders to a new workspace, one folder is "cpps" and another one is "headers"
  2. In "apps" folder there is a cpp file called "cpp_test.cpp" and in "headers" folder there are two files, "header_test.h" and "header_test.cpp".
  3. code as following:

cpp_test.cpp(in cpps folder)
#include "../headers/headers_test.h"
int cpps_test()
{
ClassA *obj = new ClassA();
obj->test(); //"go to definition" on function "test" will go to declaration instead of def.
}

headers_test.h(in headers folder)
class ClassA {
public:
ClassA(){}
int test();
};

"headers_test.cpp(in headers folder)
#include "test.h"
ClassA::test(){
int mm = 0;
}

This is a bug? Are there some ways to resolve this issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Feature: Go to DefinitionAn issue related to Go to Definition/Declaration.Language ServicebugfixedCheck the Milestone for the release in which the fix is or will be available.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions