title: How to Embind multiple cpp files in the Emscripten compiler?
body: <p>I have two cpp files called in the Main.cpp file. This code is to be called from the ams.js file. I'm using the Embind Compiler to call WASM from JS.</p>
  <p>Here is my sample code:</p>
  <p><strong>class.h:</strong></p>
  <pre><code>class CLASS{
  public:
  int VARIABLE;
  void FUNCTION();
  };
  </code></pre>
  <p><strong>class.cpp:</strong></p>
  <pre><code>#include &quot;CLASS.h&quot;
  void CLASS::FUNCTION()
  {
  VARIABLE = 5;
  
  std::cout &lt;&lt; &quot;out : &quot;+VARIABLE &lt;&lt; std::endl;
  }
  </code></pre>
  <p><strong>Main.cpp:</strong></p>
  <pre><code>#include &lt;emscripten/bind.h&gt;
  #include &quot;CLASS.h&quot;
  using namespace emscripten;
  class MyClass
  {
  public:
  MyClass(int x)
  : x(x)
  
  {}
  int getCharCount(std::string strKey)
  {
  CLASS a;
  a.FUNCTION();
  
  return 0;
  
  }
  
  private:
  int x;
  
   };
  
  EMSCRIPTEN_BINDINGS(my_class_example) {
  
   class_&lt;MyClass&gt;(&quot;MyClass&quot;)
   .constructor&lt;int&gt;()
   .function(&quot;getCharCount&quot;, &amp;MyClass::getCharCount);
      
   }
  </code></pre>
  <p>For compiling:</p>
  <pre><code>emcc --bind Main.cpp -o main.js
  </code></pre>
  <p>Calling the function in Render.js:</p>
  <pre><code>  var instance = new Module.MyClass();
    if (instance){
    var mainee  =  instance.getCharCount(&quot;hi&quot;)
    console.log(&quot;Somrthing is There&quot;);
    }else{
    console.log(&quot;Somrthing Wrong&quot;);
    }
    instance.delete();
  </code></pre>
  <p>Output error:</p>
  <pre class="lang-none prettyprint-override"><code>main3.js:2780 Uncaught BindingError: Tried to invoke ctor of MyClass with invalid number of parameters (0) - expected (1) parameters instead!
  </code></pre>
  <p>How can I solve this issue?</p>