Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disabled CPP 11, getting an error #610

Closed
judelove opened this issue Apr 11, 2016 · 4 comments
Closed

disabled CPP 11, getting an error #610

judelove opened this issue Apr 11, 2016 · 4 comments

Comments

@judelove
Copy link

Hello guys, again, I start by saying am not good with C++.

I was getting a bunch of errors that I eventually figured were as a result of some methods being called from the std namespace. A little poking around informed that these methods are in std for c++ 11, but not earlier versions.

I added this block to config.hpp, went back to armadillo and 'made (ran 'make' command), and was able to proceed some more:

**`#if !defined(ARMA_DONT_USE_CXX11)
#define ARMA_DONT_USE_CXX11
//// Uncomment the above line to forcefully disable use of C++11 features (eg. initialiser lists).

endif`**

but now I have come across an error of same nature, possibly implying that I need to go back to C++ 11 as follows:

/mlpack-master/src/mlpack/core/math/columns_to_blocks.cpp:30:32: error: ‘round’ is not a member of ‘std’

I know that going to 11 will definitely break the other files. Should I edit 'columns_to_blocks.cpp' to use the suggestions that the compiler is giving me? Please see attached capture.

PS: Am doing this on windows 10, 64 bit version, if this is any help.

c11

@judelove
Copy link
Author

As an update, in 'columns_to_block.cpp' I made this change below:

//const size_t root = (size_t) std::round(std::sqrt(value));
  const size_t root = (size_t) round(std::sqrt(value));

I guess the std qualification is necessary for C++11, which I disabled - I believe. I guess the round am using is now coming from one of the mlpack or math namespaces.

This has allowed me to proceed further with the make. Let me see how this goes.

@rcurtin
Copy link
Member

rcurtin commented Apr 11, 2016

Hey Jude,

I hope you are able to get a little further, and let me know if it works. But mlpack uses some C++11 features so I suspect there will be a lot of changes you will have to make. I think there are some old versions that maybe you could use that don't require C++11; I think maybe mlpack 1.0.10 will work (not certain):

http://www.mlpack.org/files/mlpack-1.0.10.tar.gz

Would it be possible in your situation to use C++11? That may make the compilation process a bit easier. :)

Thanks,
Ryan

@judelove
Copy link
Author

Hello Ryan,

Sorry am not able to get past the error where it says certain methods are not in the std namespace, eg "std::round" etc, which I understand are in that namespace starting with C++ 11 onwards.

I am using g++ 5.3.0, installed by Cygwin which I believe should support C++11, even the cmake report indicates that a C++11 compiler exists, but it seems the compiler is configured for a lower version. I am going to read and see if I can get my g++ into C++11 mode somehow.

Thanks for the headsup!

Jude

@rcurtin
Copy link
Member

rcurtin commented Apr 12, 2016

CMake should automatically set the right compiler flags to use C++11, so there should be nothing you need to worry about. 5.3.0 should be a recent enough version of gcc to cause no issues, I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants