title: Issue while trying to implement XGBoost C API in C++
body: <p>I am trying to implement a sample code to I found on Stackoverflow which implements XGBOOST C API in C++ (<a href="https://stackoverflow.com/questions/36071672/using-xgboost-in-c">Using XGBOOST in c++</a>). Here is the code I use:</p>
  
  <pre><code> #include &lt;iostream&gt;
  #include &lt;include/xgboost/c_api.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  
  using namespace std;
  
  int main()
  {
  // create the train data
  int cols=3,rows=5;
  float train[rows][cols];
  for (int i=0;i&lt;rows;i++)
      for (int j=0;j&lt;cols;j++)
          train[i][j] = (i+1) * (j+1);
  
  float train_labels[rows];
  for (int i=0;i&lt;rows;i++)
      train_labels[i] = 1+i*i*i;
  
  
  // convert to DMatrix
  DMatrixHandle h_train[1];
  XGDMatrixCreateFromMat((float *) train, rows, cols, -1, &amp;h_train[0]);
  
  // load the labels
  XGDMatrixSetFloatInfo(h_train[0], "label", train_labels, rows);
  
  // read back the labels, just a sanity check
  bst_ulong bst_result;
  const float *out_floats;
  XGDMatrixGetFloatInfo(h_train[0], "label" , &amp;bst_result, &amp;out_floats);
  for (unsigned int i=0;i&lt;bst_result;i++)
      std::cout &lt;&lt; "label[" &lt;&lt; i &lt;&lt; "]=" &lt;&lt; out_floats[i] &lt;&lt; std::endl;
  
  // create the booster and load some parameters
  BoosterHandle h_booster;
  XGBoosterCreate(h_train, 1, &amp;h_booster);
  XGBoosterSetParam(h_booster, "booster", "gbtree");
  XGBoosterSetParam(h_booster, "objective", "reg:linear");
  XGBoosterSetParam(h_booster, "max_depth", "5");
  XGBoosterSetParam(h_booster, "eta", "0.1");
  XGBoosterSetParam(h_booster, "min_child_weight", "1");
  XGBoosterSetParam(h_booster, "subsample", "0.5");
  XGBoosterSetParam(h_booster, "colsample_bytree", "1");
  XGBoosterSetParam(h_booster, "num_parallel_tree", "1");
  
  // perform 200 learning iterations
  for (int iter=0; iter&lt;200; iter++)
      XGBoosterUpdateOneIter(h_booster, iter, h_train[0]);
  
  // predict
  const int sample_rows = 5;
  float test[sample_rows][cols];
  for (int i=0;i&lt;sample_rows;i++)
      for (int j=0;j&lt;cols;j++)
          test[i][j] = (i+1) * (j+1);
  DMatrixHandle h_test;
  XGDMatrixCreateFromMat((float *) test, sample_rows, cols, -1, &amp;h_test);
  bst_ulong out_len;
  const float *f;
  XGBoosterPredict(h_booster, h_test, 0,0,&amp;out_len,&amp;f);
  
  for (unsigned int i=0;i&lt;out_len;i++)
      std::cout &lt;&lt; "prediction[" &lt;&lt; i &lt;&lt; "]=" &lt;&lt; f[i] &lt;&lt; std::endl;
  
  
  // free xgboost internal structures
  XGDMatrixFree(h_train[0]);
  XGDMatrixFree(h_test);
  XGBoosterFree(h_booster);
  
  return 0;
  }
  </code></pre>
  
  <p>But I get the Following error message when running the code above.</p>
  
  <pre><code>||=== Build: Debug in xgboost_demo (compiler: GNU GCC Compiler) ===|
  C:\Users\Documents\C++\xgboost_demo\main.cpp||In function 'int main()':|
  C:\Users\Documents\C++\xgboost_demo\main.cpp|63|error: invalid conversion from 'bst_ulong* {aka long long unsigned int*}' to 'int' [-fpermissive]|
  C:\Users\YannickLECROART\Documents\C++\xgboost_demo\main.cpp|63|error: cannot convert 'const float**' to 'bst_ulong* {aka long long unsigned int*}' for argument '6' to 'int XGBoosterPredict(BoosterHandle, DMatrixHandle, int, unsigned int, int, bst_ulong*, const float**)'|
  ||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
  </code></pre>
  
  <p>What am I doing wrong and what changes should I make to make it run? Thanks in advance.</p>