合成 cpp :致命错误"QApplication: no such file or directory"
Syntastic cpp : fatal error "QApplication: no such file or directory"
不知道Perl,我无法为我实验的较新的c ++库配置syntastic。Vim拒绝识别头文件。这是一个编译良好的程序,但合成显示错误:
#include <QApplication> <----------- line of error as in title
#include <QPushButton>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QPushButton hello("Hello world!");
hello.resize(100, 30);
hello.show();
return app.exec();
}
这是我在 vim 的语法检查器子目录中的 cpp.vim 文件。 注意我试图在此添加Qt4的路径,但没有使用
" in order to also check header files add this to your .vimrc:
" (this usually creates a .gch file in your source directory)
"
" let g:syntastic_cpp_check_header = 1
"
" To disable the search of included header files after special
" libraries like gtk and glib add this line to your .vimrc:
"
" let g:syntastic_cpp_no_include_search = 1
"
" To enable header files being re-checked on every file write add the
" following line to your .vimrc. Otherwise the header files are checked only
" one time on initially loading the file.
" In order to force syntastic to refresh the header includes simply
" unlet b:syntastic_cpp_includes. Then the header files are being re-checked
" on the next file write.
"
" let g:syntastic_cpp_auto_refresh_includes = 1
"
" Alternatively you can set the buffer local variable b:syntastic_cpp_cflags.
" If this variable is set for the current buffer no search for additional
" libraries is done. I.e. set the variable like this:
"
" let b:syntastic_cpp_cflags = ' -I/usr/include/libsoup-2.4'
"
" Moreover it is possible to add additional compiler options to the syntax
" checking execution via the variable 'g:syntastic_cpp_compiler_options':
"
let g:syntastic_cpp_compiler_options = ' -std=c++0x'
if exists('loaded_cpp_syntax_checker')
finish
endif
let loaded_cpp_syntax_checker = 1
if !executable('g++')
finish
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_cpp_GetLocList()
let makeprg = 'g++ -fsyntax-only '.shellescape(expand('%'))
let errorformat = '%-G%f:%s:,%f:%l:%c: %m,%f:%l: %m'
if expand('%') =~? '%(.h|.hpp|.hh)$'
if exists('g:syntastic_cpp_check_header')
let makeprg = 'g++ -c '.shellescape(expand('%'))
else
return []
endif
endif
if exists('g:syntastic_cpp_compiler_options')
let makeprg .= g:syntastic_cpp_compiler_options
endif
if !exists('b:syntastic_cpp_cflags')
if !exists('g:syntastic_cpp_no_include_search') ||
g:syntastic_cpp_no_include_search != 1
if exists('g:syntastic_cpp_auto_refresh_includes') &&
g:syntastic_cpp_auto_refresh_includes != 0
let makeprg .= syntastic#c#SearchHeaders()
else
if !exists('b:syntastic_cpp_includes')
let b:syntastic_cpp_includes = syntastic#c#SearchHeaders()
endif
let makeprg .= b:syntastic_cpp_includes
endif
endif
else
let makeprg .= b:syntastic_cpp_cflags
endif
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction
let &cpo = s:save_cpo
unlet s:save_cpo
let s:default_includes = [ '.', '..', 'include', 'includes' ]
let s:default_includes = [ '.', '..', 'include', 'includes','../include', '../includes' ]
function! s:GetIncludeDirs()
let include_dirs = s:default_includes
endfunction
" vim: set et sts=4 sw=4:
以及我的 .gvimrc 中的合成相关行:
"===============================SYNTASTICSETTINGS================================================
"set statusline+=%#warningmsg#
"set statusline+=%{SyntasticStatuslineFlag()}
"set statusline+=%*
let g:syntastic_cpp_include_dirs = ['../include','include']
let g:syntastic_cpp_check_header = 1
let g:syntastic_enable_signs=1
let g:syntastic_quiet_warnings=1
set wildchar=<Tab> wildmenu wildmode=full
我将不胜感激有关学习合成和语法检查器工作原理的帮助,因为我怀疑每次练习不同的开发工具包时都会再次出现此问题。 谢谢
您是否尝试过将syntastic_cpp_include_dirs
设置为/usr/include/qt4/QtGui
?看起来它应该给出标头所在的目录。
好吧,我复制了托管在 上的最新文件版本https://github.com/scrooloose/syntastic
现在Syntastic不再给我带来问题了。我以前拥有的版本一直给我带来问题,是http://www.vim.org/scripts/script.php?script_id=2736
相关文章:
- Android NDK clang 编译器错误在 Windows 上显示'No such file or directory'
- 已解决 - C++ 的崇高文本中的"fatal error: opencv: no such file or directory"
- "No such file or directory" C++标头问题
- 我在 #include < bits/stdc++h.> 放置时出错"No such file or directory"
- 叮叮当当。target_include_directories "No such file or directory"
- 从生成文件编译错误:"Unable to open output file" ..."No such file or directory"
- C++编译期间出现"No such file or directory"错误
- 尝试编译 TensorFlow 时出错"/system/bin/linker: No such file or directory"
- 代码块中的哈希库++库"No such file or directory"错误
- 成功使用CMakeLists制作后如何修复"open: No such file or directory"错误(该文件实际上存在)
- 如何在安装了 WSL 的 Visual Studio Code 中修复"g++: error: helloworld.cpp: No such file or directory"?
- 尝试使用生成文件编译程序时"fatal error: boost/regex.hpp: No such file or directory" C++
- SDL 测试程序 - "No such file or directory"
- GDB 列表错误"No such file or directory"
- 我的文件可以编译,但当我尝试运行它时"no such file or directory"
- 无法使用 Qt: "No such file or directory" 打开包含文件
- 如何修复"fatal error: boost/asio.hpp: no such file or directory"?
- ": No such file or directory"执行外壳文件
- 使用POCO电子邮件时每个包含"No such file/directory"
- 关于"Node,File,Directory,Link"和"Visitor"