Content of <random> not resolved [message #1753904] |
Sun, 12 February 2017 00:21  |
Eclipse User |
|
|
|
The following code does not compile. Several errors are found, namely everything that is in std:: for random is not resolved and thus compilation fails. My
#include "Grids.h"
#include <random>
namespace battleship {
Grid * generateGrid(const unsigned int & X_SIZE, const unsigned int & Y_SIZE, Ship ships[], const size_t & nShips) {
Grid * grid = new Grid(X_SIZE, Y_SIZE);
// !!! NOT FOUND ERROR!!! //
// Create RNG
std::random_device rd; // only used once to initialize (seed) engine
std::mt19937 rng(rd()); // random-number engine used (Mersenne-Twister in this case)
std::uniform_int_distribution<int> xCoordRandom(0, X_SIZE);
std::uniform_int_distribution<int> yCoordRandom(0, Y_SIZE);
std::uniform_int_distribution<int> randomOrientation(0, 1);
// !!! END OF ERROR!!! //
// TODO finish
return grid;
}
}
Here are the error codes:
Symbol 'uniform_int_distribution' could not be resolved [x3]
Type 'std::mt19937' could not be resolved
Type 'std::random_device' could not be resolved
I have set all the compilers toolchains to use C++11 in the build options and use Windows 64bits.
What can I do to resolve these issues?
Thank you very much.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04580 seconds