Tag Archives: ImportError: dynamic module does not define module export function (PyInit_tradecpt)

ImportError: dynamic module does not define module export function (PyInit_tradecpt)

After the project goes online, how to reduce customers’ doubts about the delivery?Here is the secret script of three moves>>>

PYBIND11_MODULE(tradecpt, module){
    module.doc()="tradecpt plugin";
    pybind11::class_<tradecpy::pyTradeApi>(module, "pyTradeApi")
            .def(pybind11::init<std::map<std::string,std::string>>())
            .def("Connect", &tradecpy::pyTradeApi::Connect);
    module.def("add", &add, "A function which adds two numbers", pybind11::arg("a")=1, pybind11::arg("b")=2);
}

The file name of the compiled output must be the same as pybind11_ The tradept of module (tradept, module) should be consistent