I think with your program you will get a segmentation fault. The following code should work:
#include
#include
#include
#include
int main() {
unsigned long int s;
syscall(SYS_getrandom, &s, sizeof(unsigned long int), 0);
std::cout << "The seed is: " << s << "." << std::endl;
}