Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting Vim to syntax-check boost libraries

Tags:

vim

boost

I am a fairly novice programmer who recently started using boost. After successfully linking the libraries with cmake, I have noticed that my vim (syntastic plugin I think) which does a great job at highlighting syntax errors. But ever since i started including boost libraries, it just stops at the #include statement with (no such file / directory ) and fails to show up any syntax errors whatsoever in the rest of the file. I have search all over the place but I am unable to find a workaround which allows me to syntax check bad code prior to the compilation stage. any help will be appreciated. I am unable to post screenshots (too low rating) but will post code for whatever it is worth

#include <iostream>
#include <boost/regex.hpp>     <--------------syntax error (though it compiles fine)
#include <algorithm>

using namespace std;

void testMatch(const boost::regex& ex,const string st){
  cout<<"Matching" <<st <<endl;
  if(boost::regex_match(ex,st)){
    cout<<"matches"<<endl
  }
  else cout<<"oops"; }

  void testSearch(const boost::regex& ex, const string st){
    cout<<"Searching"<<endl;





  }
like image 915
Maelstorm Avatar asked Apr 24 '26 18:04

Maelstorm


1 Answers

If you are using the Syntastic plugin, take a look at the file in

syntastic/syntax_checkers/cpp.vim

there are lots of language specific options that can be set, I think the one you'll want is

let g:syntastic_cpp_include_dirs=['path/to/boost/files']

this lets the sytax checker know that there are other places to look for included files besides the default ones.

like image 168
cdk Avatar answered Apr 28 '26 21:04

cdk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!