Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Content of <random> not resolved(Error in IDE)
Content of <random> not resolved [message #1753904] Sun, 12 February 2017 05:21 Go to next message
Samuel Beausoleil is currently offline Samuel BeausoleilFriend
Messages: 2
Registered: February 2017
Junior Member
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.
Re: Content of <random> not resolved [message #1753929 is a reply to message #1753904] Mon, 13 February 2017 04:14 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
The tool chain parameters are used only for building Makefile recipes to compile and link. They have nothing to do with the Indexer.

You are getting errors generated by the Indexer.
Specifically, the compiler builtin paths.
GCC needs to know the dialect when supplying the builtins. Certain macros have dialect specific settings.

There are two tabs at Project --> Properties --> C/C++ General --> Preprocessor Include Paths, Macros etc.
In the Providers tab, select the proper builtin provider and set the command (globally or locally) to:
${COMMAND} -std=c++11 ${FLAGS} -E -P -v -dD "${INPUTS}"
Then press Apply..
Eclipse should run the cimmand to get the builtin values.
You can verify this by allocating a console with the checkbox beneath the command.
The Entries tab should now have the c+11 builtin values.
Sometimes you need to clear the old values first using the Clear Entries button on the Providers tab.

Re: Content of <random> not resolved [message #1753978 is a reply to message #1753929] Mon, 13 February 2017 15:26 Go to previous message
Samuel Beausoleil is currently offline Samuel BeausoleilFriend
Messages: 2
Registered: February 2017
Junior Member
I used the "Index" option in the right-click menu on the project. I re-indexed it and rebuilt. Now it works. Thank you for the help!
Previous Topic:Relocation truncated to R_X86_64_32
Next Topic:CDT picks up the other undesired toolkit
Goto Forum:
  


Current Time: Sun Sep 08 01:05:25 GMT 2024

Powered by FUDForum. Page generated in 0.03563 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top