Syntastic does not check for g++14, but for gcc

瀏覽次數:135 次
跳到第一則未讀訊息

Muadib Guitarlord

未讀,
2017年8月22日 下午4:15:582017/8/22
收件者:vim-syntastic
Hello,

and for starters thank you for this amazing plugin! :)

I have a problem when checking a  .cpp file for errors, specifically it complains about "'constexpr' was not declared in this scope" while the compiler compiles without errors.

This simple code looks like this:

Int main()
{
     constexpr int LENGTH = 5;
     return 0;
}


Running :SyntasticInfo reveals:

      Syntastic version: 3.8.0-65 (Vim 800, Linux)
      Info for filetype: cpp
      Global mode: active
      Filetype cpp is active
      The current file will be checked automatically
      Available checker: gcc
      Currently enabled checker: gcc


Yet, in my .vimrc I have for Syntastic:

            let g:syntastic_go_checkers = ['golint', 'govet', 'errcheck']
            let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] }
            let g:syntastic_cpp_compiler = 'g++'
            let g:syntastic_cpp_compiler_options = '-std=gnu++1z'


Any help kindly appreciated!

All Best,
Muadib25

LCD 47

未讀,
2017年8月22日 下午4:43:242017/8/22
收件者:vim-syntastic
On 22 August 2017, Muadib Guitarlord <muad...@gmail.com> wrote:
> Hello,
>
> and for starters thank you for this amazing plugin! :)
>
> I have a problem when checking a .cpp file for errors, specifically it
> complains about "'constexpr' was not declared in this scope" while the
> compiler compiles without errors.
>
> This simple code looks like this:
>
>
>
>
>
> *Int main(){ constexpr int LENGTH = 5; return 0;}*
>
> Running :SyntasticInfo reveals:
>
>
>
>
>
>
>
> * Syntastic version: 3.8.0-65 (Vim 800, Linux) Info for filetype:
> cpp Global mode: active Filetype cpp is active The current
> file will be checked automatically Available checker: gcc
> Currently enabled checker: gcc*
>
> Yet, in my .vimrc I have for Syntastic:
>
> let g:syntastic_go_checkers = ['golint', 'govet', 'errcheck']
> let g:syntastic_mode_map = { 'mode': 'active',
> 'passive_filetypes': ['go'] }
> let g:syntastic_cpp_compiler = 'g++'
> let g:syntastic_cpp_compiler_options = '-std=gnu++1z'
>
>
> Any help kindly appreciated!

I can't reproduce this with gcc 7.2.0. Please enable debugging
(cf. ":h syntastic-debug") and make sure the command syntastic runs
ressembles what you thought it runs.

Also please consider not using HTML formatting in your bug reports
to this group. As you can see above it makes your reports impossible to
handle by email. Better yet, post further issues to the official issue
tracker at GitHub.

/lcd

Muadib Guitarlord

未讀,
2017年8月22日 晚上11:56:492017/8/22
收件者:vim-syntastic
@lcd,

Thanks for the help, will do so.

As for syntastic-debug, I added in .vimrc:
"let g:syntastic_debug = 33"

as per the help you named, but I didn't get any special messages when running ':mes' after ':SyntasticCheck'.

Best Regards,
M

LCD 47

未讀,
2017年8月23日 凌晨12:43:412017/8/23
收件者:vim-syntastic
On 22 August 2017, Muadib Guitarlord <muad...@gmail.com> wrote:
What kind of "special" message did you expect? Please:

(1) open your test file
(2) run:

:let g:syntastic_debug=3
:SyntasticCheck gcc
:mes

(3) post the (unedited) output.

You can tell Vim to redirect said output to a file if you need to.

/lcd

Muadib Guitarlord

未讀,
2017年8月23日 凌晨12:47:242017/8/23
收件者:vim-syntastic
Great, 
Will do so tonight when I get home.

Thanks again, lcd!
M.

Muadib Guitarlord

未讀,
2017年8月23日 上午11:31:542017/8/23
收件者:vim-syntastic
Regarding the 'special messages' I mentioned earlier, I was expecting a log or something.
Speaking of which, the ':let g:syntastic_debug=3' one did the trick.

Here is the unedited output:


Messages maintainer: Bram Moolenaar <Br...@vim.org>
"Main.cpp" 24L, 532C
syntastic: 34.742935: g:syntastic_version = '3.8.0-65 (Vim 800, Linux)'
syntastic: 34.743225: &shell = '/bin/sh' (!), &shellcmdflag = '-c', &shellpipe = '2>&1| tee', &shellquote = '', &shellredir = '>%s 2>&1
', &shelltemp = 1, &shellxquote = '', &autochdir = 0, &shellxescape = ''
syntastic: 34.744236: UpdateErrors: gcc
syntastic: 34.744678: CacheErrors: gcc
syntastic: 34.746479: g:syntastic_aggregate_errors = 0
syntastic: 34.746868: getcwd() = '/home/orpheus/Documents/Unreal Projects/Section_02/BullCowGame'
syntastic: 34.791880: CacheErrors: Invoking checker: cpp/gcc
syntastic: 34.794037: SyntasticMake: called with options: {'postprocess': [], 'errorformat': '%-G%f:%s:,%f:%l:%c: %trror: %m,%f:%l:%c:
%tarning: %m,%f:%l:%c: %m,%f:%l: %trror: %m,%f:%l: %tarning: %m,%f:%l: %m', 'makeprg': '''g++'' -x c++ -fsyntax-only  -I. -I.. -Iinclud
e -Iincludes -I../include -I../includes   Main.cpp'}
syntastic: 35.449227: system: command run in 0.654829s
syntastic: 35.449459: checker output: ['Main.cpp: In function ‘int main()’:', 'Main.cpp:19:5: error: ‘constexpr’ was not declared in th
is scope', '     constexpr int WORD_LENGTH = 5;', '     ^', 'Main.cpp:21:37: error: ‘WORD_LENGTH’ was not declared in this scope', '
  cout << "Can you guess the " << WORD_LENGTH;', '                                     ^', '']
syntastic: 35.450461: raw loclist: [{'lnum': 19, 'bufnr': 1, 'col': 5, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': 'e', 'pattern': '', 'te
xt': '‘constexpr’ was not declared in this scope'}, {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '', 'pat
tern': '', 'text': '     constexpr int WORD_LENGTH = 5;'}, {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '
', 'pattern': '', 'text': '     ^'}, {'lnum': 21, 'bufnr': 1, 'col': 37, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': 'e', 'pattern': '', '
text': '‘WORD_LENGTH’ was not declared in this scope'}, {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '',
'pattern': '', 'text': '     cout << "Can you guess the " << WORD_LENGTH;'}, {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, '
nr': -1, 'type': '', 'pattern': '', 'text': '                                     ^'}, {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'v
col': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': ''}]
syntastic: 35.451066: getLocList: checker cpp/gcc returned 1
syntastic: 35.451273: cpp/gcc raw: [{'lnum': 19, 'bufnr': 1, 'col': 5, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': 'e', 'pattern': '', 'te
xt': '‘constexpr’ was not declared in this scope'}, {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '', 'pat
tern': '', 'text': '     constexpr int WORD_LENGTH = 5;'}, {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '
', 'pattern': '', 'text': '     ^'}, {'lnum': 21, 'bufnr': 1, 'col': 37, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': 'e', 'pattern': '', '
text': '‘WORD_LENGTH’ was not declared in this scope'}, {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '',
'pattern': '', 'text': '     cout << "Can you guess the " << WORD_LENGTH;'}, {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, '
nr': -1, 'type': '', 'pattern': '', 'text': '                                     ^'}, {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'v
col': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': ''}]
syntastic: 35.451906: quiet_messages filter: {}
syntastic: 35.452120: getLocList: checker cpp/gcc run in 0.660089s
syntastic: 35.452704: aggregated: {'_sorted': 0, '_name': 'gcc (cpp)', '_owner': 1, '_columns': 1, '_rawLoclist': [{'lnum': 19, 'bufnr'
: 1, 'col': 5, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': 'e', 'pattern': '', 'text': '‘constexpr’ was not declared in this scope'}, {'ln
um': 21, 'bufnr': 1, 'col': 37, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': 'e', 'pattern': '', 'text': '‘WORD_LENGTH’ was not declared in
 this scope'}]}
Press ENTER or type command to continue


Best Regards,
M.

LCD 47

未讀,
2017年8月23日 上午11:43:372017/8/23
收件者:vim-syntastic
On 23 August 2017, Muadib Guitarlord <muad...@gmail.com> wrote:
> Regarding the 'special messages' I mentioned earlier, I was expecting a log
> or something.
> Speaking of which, the ':let g:syntastic_debug=3' one did the trick.
>
> Here is the unedited output:
>
[...]
> syntastic: 34.746868: getcwd() = '/home/orpheus/Documents/Unreal
> Projects/Section_02/BullCowGame'
> syntastic: 34.791880: CacheErrors: Invoking checker: cpp/gcc
> syntastic: 34.794037: SyntasticMake: called with options: {'postprocess':
> [], 'errorformat': '%-G%f:%s:,%f:%l:%c: %trror: %m,%f:%l:%c:
> %tarning: %m,%f:%l:%c: %m,%f:%l: %trror: %m,%f:%l: %tarning: %m,%f:%l: %m',
> 'makeprg': '''g++'' -x c++ -fsyntax-only -I. -I.. -Iinclud
> e -Iincludes -I../include -I../includes Main.cpp'}
[...]

Ok, so here's what syntastic does:

cd /home/orpheus/Documents/UnrealProjects/Section_02/BullCowGame
g++ -x c++ -fsyntax-only -I. -I.. -Iinclude -Iincludes -I../include -I../includes Main.cpp

The option "-std=gnu++1z" is somehow lost, which means either you messed
up the name of the relevant option, or the file that contains said
option doesn't get sourced by Vim. What happens if you set it manually:
open your test file and run:

:let g:syntastic_cpp_compiler_options='-std=gnu++1z'
:let g:syntastic_debug=3
:SyntasticCheck gcc
:mes

/lcd

Muadib Guitarlord

未讀,
2017年8月23日 上午11:56:022017/8/23
收件者:vim-syntastic
I solved the issue, I was adding the syntastic lines together with the ones supplied with spf13 plugin package,
but those are inside an 'if' statement.

I took them out in the open and that solved the problem, Syntastic now happily checks against '-std=c++14' now.


Thank you! :)
M.



Muadib Guitarlord

未讀,
2017年8月23日 中午12:02:262017/8/23
收件者:vim-syntastic
By mentioning Syntastic lines, I mean the ones inside the .vimrc config file.

I just saw yor reply, it checks correctly.

syntastic: 235.314307: SyntasticMake: called with options: {'postprocess': [], 'errorformat': '%-G%f:%s:,%f:%l:%c: %trror: %m,%f:%l:%c:
 %tarning: %m,%f:%l:%c: %m,%f:%l: %trror: %m,%f:%l: %tarning: %m,%f:%l: %m', 'makeprg': '''g++'' -x c++ -fsyntax-only -std=gnu++1z -I.
-I.. -Iinclude -Iincludes -I../include -I../includes   Main.cpp'}


Thanks again, lcd!

All Best,
M.
回覆所有人
回覆作者
轉寄
0 則新訊息