When trying to compile the following source code:
#include <random> #include <iostream> int main(){ std::tr1::random_device rd; std::tr1::mt19937 rng(rd()); std::tr1::uniform_int<int> uni(0,20); std::cout<<uni(rng)<<std::endl; } bcc32.exe t.cpp I get this error:
Turbo Incremental Link 6.51 Copyright (c) 1997-2013 Embarcadero Technologies, Inc. Error: Unresolved external 'std::tr1::_Random_device()' referenced from <...>\T.OBJ Error: Unable to perform link Compiler version 6.70.4983.33517 of RAD Studio XE5
How to fix this error? Maybe you need to connect some kind of library?
std::tr1::mt19937 rng(rd);- this? It seems to be necessarystd::tr1::mt19937 rng(rd());. And also - what, Borland still keeps it all intr1, not just instd? If you delete::tr1, what do you get? - Harryrd(), I'll fix it now. But the error remains, of course. Withouttr1will be something likeError E2316 t.cpp 5: 'random_device' is not a member of 'std' in function main()- Im ieee