[mlpack] [mlpack/mlpack] Clear example for compiling example programs (#815)
Tony Reina
notifications at github.com
Tue Dec 20 20:16:57 EST 2016
I followed Alex's apt-get commands and it seemed to install for me on Ubuntu 16.04.
I took the example file and tried to compile it just like Alex compiled nnserach.cpp:
`// Includes all relevant components of mlpack.
#include <mlpack/core.hpp>
// Convenience.
using namespace mlpack;
int main()
{
// First, load the data.
arma::mat data;
// Use data::Load() which transposes the matrix.
data::Load("data.csv", data, true);
// Now compute the covariance. We assume that the data is already centered.
// Remember, because the matrix is column-major, the covariance operation is
// transposed.
arma::mat cov = data * trans(data) / data.n_cols;
// Save the output.
data::Save("cov.csv", cov, true);
}
`
However, it is giving me lots of errors about not finding declarations:
`gcc mlpackTest.cpp -o mlOutTest -lboost_serialization -larmadillo -lmlpack
In file included from /usr/include/c++/5/unordered_map:35:0,
from /usr/include/mlpack/core/boost_backport/unordered_map.hpp:23,
from /usr/include/mlpack/prereqs.hpp:64,
from /usr/include/mlpack/core.hpp:196,
from mlpackTest.cpp:2:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support \
^
In file included from /usr/include/mlpack/prereqs.hpp:64:0,
from /usr/include/mlpack/core.hpp:196,
from mlpackTest.cpp:2:
/usr/include/mlpack/core/boost_backport/unordered_map.hpp:98:16: error: ‘unordered_map’ in namespace ‘std’ does not name a template type
const std::unordered_map<
^
/usr/include/mlpack/core/boost_backport/unordered_map.hpp:98:29: error: expected ‘,’ or ‘...’ before ‘<’ token
const std::unordered_map<
^
/usr/include/mlpack/core/boost_backport/unordered_map.hpp: In function ‘void boost::serialization::save(Archive&, int)’:
/usr/include/mlpack/core/boost_backport/unordered_map.hpp:105:9: error: ‘unordered_map’ is not a member of ‘std’
std::unordered_map<
^
/usr/include/mlpack/core/boost_backport/unordered_map.hpp:105:9: error: ‘unordered_map’ is not a member of ‘std’
`
It seems to be finding the includes, but I have no clue as to what other compile and link flags I need to get things built.
What IDE do you guys use to build projects on Linux? Or, do you just use text editors and CMake.
Thanks.
-Tony
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/mlpack/mlpack/issues/815#issuecomment-268407230
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://knife.lugatgt.org/pipermail/mlpack/attachments/20161220/f8b239b8/attachment.html>
More information about the mlpack
mailing list