title: Expected initializer before 'token'
body: <p>I know there are several questions about this error message but I did not find a suitable solution for my case. I want to export the Filter class from a library. Visual Studio 2013 just compiles fine, but gcc throws the error:</p>
  
  <pre><code>prog.cpp:16:17: error: expected initializer before 'Filter'
   class DllExport Filter{
                   ^
  prog.cpp:22:6: error: 'Filter' has not been declared
   void Filter::setFilter(const std::vector&lt;float&gt;&amp; vFilter, unsigned int uNumThreads) {
        ^
  </code></pre>
  
  <p>The code:</p>
  
  <pre><code>#ifndef _GNULINUX
  #define DllExport __declspec(dllexport)
  #else
  #define DllExport __attribute__((visibility("default")))
  #endif
  
  #include &lt;string&gt;
  #include &lt;vector&gt;
  #include &lt;iostream&gt;
  
  #ifdef __cplusplus
  extern "C" {
      namespace FilterAPI {
  #endif
  
  class DllExport Filter{
  public:
      static void setFilter(const std::vector&lt;float&gt;&amp; vFilter, unsigned int uNumThreads);
  
  };
  
  void Filter::setFilter(const std::vector&lt;float&gt;&amp; vFilter, unsigned int uNumThreads) {
  }
  
  #ifdef __cplusplus
  }  //  namespace FilterAPI
  }  //  extern "C" {
  #endif
  </code></pre>
  
  <p>See also
  <a href="https://ideone.com/3VV4AH" rel="nofollow">https://ideone.com/3VV4AH</a></p>
  
  <p>Edit:</p>
  
  <p>flags in the make file are:</p>
  
  <pre><code># CMAKE generated file: DO NOT EDIT!
  # Generated by "Unix Makefiles" Generator, CMake Version 2.8
  
  # compile CXX with /usr/bin/c++
  CXX_FLAGS = -fPIC  
  
  CXX_DEFINES = -DFilter_Library_EXPORTS
  </code></pre>