Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8269547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T06:16:10+00:00 2026-06-08T06:16:10+00:00

I am using MTRand (the Mersenne Twister random number generator from http://www.bedaux.net/mtrand/ ) inside

  • 0

I am using MTRand (the Mersenne Twister random number generator from http://www.bedaux.net/mtrand/) inside a class that I have defined. And when I try to compile I get an unexpected error that I can’t decode. I’m a novice c++ programmer, so any help will go a long way…

Here is the relevant portion of my code:

#include<iostream>
#include<vector>
#include<deque>
#include<cmath>
#include "./mtrand/mtrand.h"


using namespace std;

class mp{
  long double store;
  deque< vector<long double> > stack;
  long double boundary;
  long double dt;
  long double time;
  MTRand_open random;
  long int random_seed;



public:
  void initialize(long int, long double, long double);
  long double get_state(); // return the state at position int
  void update();
  friend long double A(mp*);
  friend long double D(mp*);
  long double normal();
  vector <long double> viewCurrent(); 


};

There is then a function, which, if called, sets a seed for the random number generator

void mp::initialize(long int rand_seed_input, long double bdry_in, long double dt_in){


  time = 0;
  dt = dt_in;

  random_seed = rand_seed_input;

  random.seed(random_seed);

  boundary = bdry_in; 
}

I just want to test if this compiles, so I create a main function that does precisely nothing:

int main(){
return 0;
}

On compile time, I get an error

Undefined symbols:
  "MTRand_int32::seed(unsigned long)", referenced from:
      mp::initialize(int, long, long double, long double)in ccJylsHh.o
  "MTRand_int32::p", referenced from:
      MTRand_int32::rand_int32()       in ccJylsHh.o
      MTRand_int32::rand_int32()       in ccJylsHh.o
      MTRand_int32::rand_int32()       in ccJylsHh.o
  "MTRand_int32::state", referenced from:
      MTRand_int32::rand_int32()       in ccJylsHh.o
  "MTRand_int32::gen_state()", referenced from:
      MTRand_int32::rand_int32()       in ccJylsHh.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

I am not sure what this error means, and how it should be removed.

From what I understand is that MTRand can’t figure out how to initialize the seed…but there is a default seeding within the class MTRand so I can’t see what the problem is.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T06:16:12+00:00Added an answer on June 8, 2026 at 6:16 am

    In addition to including mtrand.h header in your code with a correct file path, you should probably add mtrand.cpp to your project so that it compiles along with other .cpp files of your program.

    If the library you use does not provide any pre-compiled binaries, like .lib, .dll, or .a files, then yes, you have to compile the library’s source code by yourself (Not much of work right?) in order to make the linker happy. But if the library does go accompanied with such pre-compiled binaries, then you should tell the linker what files it needs to link against to be able to find how the declarations in the library’s header files are actually implemented, because linker has no idea otherwise. How you actually link a pre-compiled binary depends on your development environment. Of course, you should include the header files in both cases to tell compiler what does MTRand_int32 and other new identifiers mean.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok, I'm using a raw SHA1 hash to seed a Mersenne Twister pseudo-random number
Using the http://www.ifans.com/forums/showthread.php?t=132024 post from another question i am allowing the user to enter
A while back I wrote a random string generator that builds a string using
I want to generate a 6 digit random number using the PHP mt_rand() function.
Using the java.util.concurrent.locks.ReentrantLock library as follows: Two threads generate a random number and use
My problem is that I am using the random string creator shown below, I
EDIT: after reading this http://projects.scipy.org/numpy/ticket/1322 it seems that the NumPy version I am using
using this http://bl.ocks.org/950642 we can see how to add images to nodes, the question
I have been using the encryption class of codeigniter (PHP framework) for a while
Using System.Diagnostics.EventLog .NET type one can programmatically create logs into the Event Viewer application.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.