I'm separating the functions from main.c to func1.c func2.c, then I'm using util.h to store the prototype (all name of all functions).


when I try to go to implementation, lsp leading me into util.c, but i want to leading to func1.c


#include "util.h"

int main(){
  int x = fun||c1(); // here || is cursure location !
  int y = funct2();


#define TRUE 1
#define FALSE 0
int func1();
int func2();


int  func1(){


all: main

main: func1.o func2.o ... main.o
    gcc func1.o func2.o ... main.o -o main

func1.o: func1.c util.h
    gcc func1.c

func2.o: func2.c util.h
    gcc func2.c

my env:

i use:

  • neovim as ide
  • lspconfig plugin handle lsp
  • ccls/clangd is tow lsp for c/cpp
  • :lua vim.lsp.buf.implementation() go to implementation but lead me to util.h
  • :lua vim.lsp.buf.definition() go to definition but lead me to util.h too

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.