Exporting from C++ with Emscripten returns class template error

  c++, emscripten, javascript

I am encountering problems when trying to export C++ functions I’ve made to a JavaScript file. The functions are scattered through various .hpp files, and when I do the following, an error apears:

#include <emscripten/bind.h>
#include "heuristic.hpp"

using namespace emscripten;

double func(double lat1, double lon1,   double lat2, double lon2,bool method) {
    double a = heuristic(lat1,lon1,lat2,lon2,method);
    return a;

    function("func", &func); 

Function, inside EMSCRIPTEN_BINDINGS, is high lighted in red, as I am using VSCode, and it says the states the error:

argument list for class template "std::function" is missing

And compiling it with emscripten runs fine but it is unable to access the function.

Am I missing something? Is there something I should try? Another way of exporting the function?
I am not a native C++ coder, maybe I’m making a trivial mistake.

Source: Windows Questions C++