Skip to content
Branch: master
Find file History
wkcn and szha print error message for mxnet::cpp::Operator::Invoke when failed (#14318

* raise exceptions for mxnet::cpp::Operator::Invoke when failed

* fix input shape

* fix cpplint

* fix cpp-package example shape
Latest commit 6caaa38 Mar 7, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
example print error message for mxnet::cpp::Operator::Invoke when failed (#14318 Mar 7, 2019
include/mxnet-cpp print error message for mxnet::cpp::Operator::Invoke when failed (#14318 Mar 7, 2019
scripts Aggregate SGD (#13346) Jan 24, 2019
CMakeLists.txt CMake: Enable installation of cpp-package headers (#13339) Dec 31, 2018
LICENSE fix website build (#14148) Feb 14, 2019 [MXNET-1121] Example to demonstrate the inference workflow using RNN (#… Feb 7, 2019

MXNet C++ Package

The MXNet C++ Package provides C++ API bindings to the users of MXNet. Currently, these bindings are not available as standalone package. The users of these bindings are required to build this package as mentioned below.

Building C++ Package

The cpp-package directory contains the implementation of C++ API. As mentioned above, users are required to build this directory or package before using it. The cpp-package is built while building the MXNet shared library,

Steps to build the C++ package:

  1. Building the MXNet C++ package requires building MXNet from source.

  2. Clone the MXNet GitHub repository recursively to ensure the code in submodules is available for building MXNet.

    git clone --recursive mxnet
  3. Install the prerequisites, desired BLAS libraries and optional OpenCV, CUDA, and cuDNN for building MXNet from source.

  4. There is a configuration file for make, make/ that contains all the compilation options. You can edit this file and set the appropriate options prior to running the make command.

  5. Please refer to platform specific build instructions and available build configurations for more details.

  6. For enabling the build of C++ Package, set the USE_CPP_PACKAGE = 1 in make/ Optionally, the compilation flag can also be specified on make command line as follows.

    make -j USE_CPP_PACKAGE=1


In order to consume the C++ API please follow the steps below.

  1. Ensure that the MXNet shared library is built from source with the USE_CPP_PACKAGE = 1.
  2. Include the MxNetCpp.h in the program that is going to consume MXNet C++ API.
    #include <mxnet-cpp/MxNetCpp.h>
  3. While building the program, ensure that the correct paths to the directories containing header files and MXNet shared library.
  4. The program links the MXNet shared library dynamically. Hence the library needs to be accessible to the program during runtime. This can be achieved by including the path to the shared library in the environment variable LD_LIBRARY_PATH for Linux, Mac. and Ubuntu OS and PATH for Windows OS.


A basic tutorial can be found at


The example directory contains examples for you to get started. Please build the MXNet C++ Package before building the examples.

You can’t perform that action at this time.