Eclipse Luna, MinGW-w64 -- C++11 <random> [message #1403771] |
Sat, 26 July 2014 11:21  |
Eclipse User |
|
|
|
Under newly-released Luna and new CDT for Windows x64 with MinGW-W64 (tried two different compilers) 4.8.2, Eclipse does not seem to index the <random> header. Using the code below results in red squigglies with messages:
1) "Type 'std::random_device' could not be resolved"
2) "Symbol 'uniform_int_distribution' could not be resolved"
However, the program DOES build and run in Eclipse.
C++11 support is enabled via Dialect option. I also tried the old way with both -std=c++0x and -std=c++11.
The program compiles and outputs correctly when compiled on the command line. It also works using QTCreator pointing to the same compiler. No errors are reported in either case.
#include <iostream>
#include <random>
int main()
{
std::random_device rng;
std::uniform_int_distribution<> uid(1, 10);
for(std::size_t i = 0; i < 10; i++)
{
std::cout << uid(rng) << " ";
}
std::cout << std::endl;
return 0;
}
Am I doing something wrong?
Thanks
|
|
|
|
|
|
|
|
Re: Eclipse Luna, MinGW-w64 -- C++11 <random> [message #1404517 is a reply to message #1403952] |
Sat, 02 August 2014 14:44  |
Eclipse User |
|
|
|
Hi Klaus,
Apologies for the delay -- away for work for a few days with no access to a Windows PC.
Codan settings were identical. However, I know why I was getting different results. Kepler wasn't "completely untouched" as I had said -- in fact, I had added the -std=c++11 flag to the "Command to get compiler specs" (workspace-wide) the previous night and then forgotten about it. All other settings are the same.
Please also see my latest post on the bugzilla. This seems to solve the problem in Luna and in Kepler -- however, I find it strange that it is necessary with the new "Dialect" option. Nonetheless, there it is.
Thanks for your help!
[Updated on: Sat, 02 August 2014 14:46] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.08679 seconds