在丢失的C头文件上禁用vim的位置列表 [英] Disabling vim's location list on missing C header file

查看:97
本文介绍了在丢失的C头文件上禁用vim的位置列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在C语言中,Vim非常聪明,因此如果插入虚假的头文件(例如#include <stdioo.h>),它会通过显示以下错误提示位置信息:

Vim is pretty smart when it comes to C, so if one inserts a bogus header file such as #include <stdioo.h>, it complains by bringing up a location list with the following error:

foo.c:1 | 20 |严重错误:stdioo.h:没有这样的文件或目录 ||编译终止.

foo.c:1|20| fatal error: stdioo.h: No such file or directory || compilation terminated.

这很棒,但是无论出于什么原因,当包含<mpi.h>头文件时,我都会遇到相同的错误.我知道这是一个vim问题b/c我可以分别使用mpiccmpiexec编译和执行程序.每次保存文件时都会弹出该对话框,这非常令人不快,而且在发生这种情况时,所有语法错误都将被忽略.

Which is great, but for whatever reason, I get the same error when including the <mpi.h> header file. I know this is a vim problem b/c I can compile and execute the program with mpicc and mpiexec, respectively. Besides it being extremely irritating having it pop up every time I save the file, all syntax errors are ignored when this happens.

有什么方法可以指示vim忽略该头文件,或者至少忽略所有头文件?

Is there any way to instruct vim to ignore this header file, or at least all the header files?

推荐答案

文件系统上的< mpi.h> 文件位于何处?

WHERE on your filesystem is the <mpi.h> file located?

通常它是下一层,例如/usr/include/mpi/mpi.h ,并且需要< mpi/mpi.h> 才能访问它.

Often it's one level down, such as /usr/include/mpi/mpi.h and would require <mpi/mpi.h> to access it.

您可能需要在编译器的 -I 选项列表中添加另一个目录路径,或在VIM的 path 选项变量中添加目录路径

You may need to add another directory path to the -I option list of your compiler, or add the directory path to VIM's path option variable

:help 'path

从VIM方面开始,您将需要查找如何在当前设置中添加选项,不知道是使用cmake,make,视觉效果,netclipse还是其他方法.

Will get you started on the VIM side, you'll need to look up how to add options to your current setup, no idea if you're using cmake, make, visual something, netclipse or whatever.

但是一个简单的' locate mpi.h '将是开始的地方,因为您知道它就在那里.

But a simple 'locate mpi.h' would be the place to start, since you know it's there.

您说的是弹出式" ...您正在使用合成词或类似词吗?同样,找到正确的路径也将有所帮助.显然,mpicc知道包含文件的正确路径,您只需要告诉VIM. (通过路径"选项)

You said "pop-up" ... are you using syntastic or such? Again, finding the proper path would help there too. Evidently mpicc knows the proper path to the include files, you just need to tell VIM. (via the 'path' option)

这篇关于在丢失的C头文件上禁用vim的位置列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆