Disabling vim's location list on missing C header file

邮差的信 提交于 2019-12-24 20:28:16

问题


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| fatal error: stdioo.h: No such file or directory || compilation terminated.

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.

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


回答1:


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

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

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

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.

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

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)



来源:https://stackoverflow.com/questions/11407565/disabling-vims-location-list-on-missing-c-header-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!