title: declaring a vector-using function within extern "C"{}
body: <p>I have one file (<em>FILE_A.cpp</em>) with a function's body as follows:</p>
  
  <pre><code>vector&lt;char *&gt; lines_vector;
  foo(my_file_path, "zzz", lines_vector, fout);
  </code></pre>
  
  <p><code>foo</code> is defined in another file (<em>FILE_B.cpp</em>):</p>
  
  <pre><code>void foo(char * in_file, char * keyword, vector&lt;char *&gt;&amp; lines_vector, FILE * fout)
  </code></pre>
  
  <p>Since <em>FILE_A.cpp</em> uses <em>FILE_B.cpp</em>'s function, it includes its headed, and here's the problem: </p>
  
  <p>FILE_B.h has all of its function headers inside a </p>
  
  <pre><code>#ifdef __cplusplus
  extern "C" {
  #endif
  ...
  void foo(char * in_file, char * keyword, vector&lt;char *&gt;&amp; lines_vector, FILE * fout)
  ...
  #ifdef __cplusplus
  };
  #endif
  </code></pre>
  
  <p>and when trying to add my function it doesn't recognize the vector. The errors given are</p>
  
  <blockquote>
    <p>1) expected ',' or '...' before '&lt;' token</p>
    
    <p>2) expected initializer before '}' token  </p>
    
    <p>3) 'vector' has not been declared</p>
  </blockquote>
  
  <p>which makes me suspect that <code>extern C</code> can't parse this. Is there a problem in using cpp objects inside <code>extern "C" {}</code> or is there another problem here?</p>