title: 'gsl/gsl' file not found, emscripten. HOw to include the ms-gsl library to be compiled when creating WASM from C++
body: <p>I'm compiling some C++ with emscripten and I'm having a problem to use some features from gsl such as &quot;Expects&quot;. The emcc can't find &quot;gsl/gsl&quot;.
  How can I compile it with gsl?</p>
  <p>Here is the header file:</p>
  <pre><code>#ifndef ROBOT_CPP_PWMTEST_H
  #define ROBOT_CPP_PWMTEST_H
  
  #include &lt;iostream&gt;
  #include &lt;gsl/gsl&gt;
  
  class PwmTest {
  
  public:
      int duty_cycle_pwm_a;
      int duty_cycle_pwm_b;
      explicit PwmTest();
      ~PwmTest();
      int setPwmA(int duty_cycle);
      int getPwmA();
  };
  
  
  #endif //ROBOT_CPP_PWMTEST_H
  </code></pre>
  <p>Here is the source file:</p>
  <pre><code>#include &quot;PwmTest.h&quot;
  
  PwmTest::PwmTest()
  {
      duty_cycle_pwm_a = 0;
      duty_cycle_pwm_b = 0;
      std::cout &lt;&lt; &quot;PWM instance Created&quot; &lt;&lt; std::endl;
  }
  
  PwmTest::~PwmTest()
  {
      std::cout &lt;&lt; &quot;PWM instance Destroyed&quot; &lt;&lt; std::endl;
  }
  
  
  int PwmTest::setPwmA(int duty_cycle)
  {
      Expects(-1 &lt; duty_cycle &amp;&amp; duty_cycle &lt;= 100);
      duty_cycle_pwm_a = duty_cycle;
      std::cout &lt;&lt; &quot;PWM A is set to &quot; &lt;&lt; duty_cycle_pwm_a &lt;&lt; std::endl;
      return 0;
  }
  
  int PwmTest::getPwmA()
  {
      std::cout &lt;&lt; &quot;PWM A value is: &quot; &lt;&lt; duty_cycle_pwm_a &lt;&lt; std::endl;
      return duty_cycle_pwm_a;
  }
  
  
  #ifdef __EMSCRIPTEN__
  
  #include &lt;emscripten.h&gt;
  #include &lt;emscripten/bind.h&gt;
  
  EMSCRIPTEN_BINDINGS(pwm_class_emscripten) {
      emscripten::class_&lt;PwmTest&gt;(&quot;PwmTest&quot;)
      .constructor&lt;&gt;()
      .function(&quot;setPwmA&quot;, &amp;PwmTest::setPwmA)
      .function(&quot;getPwmA&quot;, &amp;PwmTest::getPwmA)
      .property(&quot;duty_cycle_pwm_a&quot;, &amp;PwmTest::duty_cycle_pwm_a)
      ;
  }
  #endif
  </code></pre>
  <p>It works if I take the gsl off of it.</p>