Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing Vim :make with quickfix ends up creating a new file when error is in header
    primarykey
    data
    text
    <p>I've got a setup with Vim where I can compile my C/C++ code using <code>:make</code> and compilation errors are automatically shown in a quickfix window using the following lines <a href="http://vim.wikia.com/wiki/Automatically_open_the_quickfix_window_on_:make" rel="noreferrer">(from the Vim wiki)</a> in my <code>./vimrc</code>:</p> <pre><code>" Automatically open, but do not go to (if there are errors) the quickfix / " location list window, or close it when is has become empty. " " Note: Must allow nesting of autocmds to enable any customizations for quickfix " buffers. " Note: Normally, :cwindow jumps to the quickfix window if the command opens it " (but not if it's already open). However, as part of the autocmd, this doesn't " seem to happen. autocmd QuickFixCmdPost [^l]* nested cwindow autocmd QuickFixCmdPost l* nested lwindow </code></pre> <p>Now this setup works well if there is an <strong>error in a .cpp file</strong>, as the output from make is correctly parsed:</p> <pre><code>$ make g++ -c -o IsingMain.o IsingMain.cpp g++ -c -o LatticeModel.o LatticeModel.cpp LatticeModel.cpp: In member function ‘void LatticeModel::initialiseSystem()’: LatticeModel.cpp:18:25: error: ‘sirand’ was not declared in this scope </code></pre> <p>i.e. vim correctly switches to <code>LatticeModel.cpp</code>.</p> <hr> <p>However if the error is in the <strong>header file</strong>, the make output is misinterpreted, and vim switches/creates a new buffer (for the following example <code>make</code> output) with name "<code>In file included from IsingMain.cpp</code>", clearly erroneously assuming that this is the file with the error (in fact the error is in LatticeModel.h):</p> <pre><code>$ make g++ -c -o IsingMain.o IsingMain.cpp In file included from IsingMain.cpp:2:0: LatticeModel.h:31:5: error: ‘Zvoid’ does not name a type </code></pre> <p>Running make from the commandline works perfectly well, it's just an issue with quickfix misreading it's output. Any help greatly appreciated, let me know if any part of this is confusing. Thanks</p> <p><strong>EDIT</strong>: It seems to be something to do with with an incorrect errorformat (as described in <a href="http://vim.1045645.n5.nabble.com/vim-errorformat-requires-updating-for-gcc-4-5-unreleased-td1205444.html" rel="noreferrer">this thread</a>.)</p> <p><strong>EDIT 2</strong>: Temporary fix found by ignoring the make output line that starts with "In file included from" using <a href="http://groups.google.com/group/vim_dev/msg/ed4f258f5b4b9749" rel="noreferrer">this technique</a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload