venkatarun95/genericCC

error: ‘mt19937’ in namespace ‘boost::random’ does not name a type

krayc425 opened this issue · 2 comments

Hi venkatarun,

When compiling this repo, I encounter the problem that says:

krayc@ubuntu:~/Desktop/genericCC$ makepp
makepp: Loading makefile `/home/krayc/Desktop/genericCC/makefile'
makepp: Entering directory `/home/krayc/Desktop/genericCC'
protoc --cpp_out=. protobufs-default/dna.proto
makepp: Scanning `/home/krayc/Desktop/genericCC/protobufs-default/dna.pb.cc'
makepp: Scanning `/home/krayc/Desktop/genericCC/protobufs-default/dna.pb.h'
g++ -I.. -I. -O2 -fPIC -c protobufs-default/dna.pb.cc -o protobufs-default/dna.pb.o
makepp: Scanning `/home/krayc/Desktop/genericCC/estimators.cc'
makepp: Scanning `/home/krayc/Desktop/genericCC/estimators.hh'
g++ -I./protobufs-default -I./udt -DHAVE_CONFIG_H -std=c++11 -pthread -pedantic -Wall -Wextra -Weffc++ -Werror -fno-default-inline -g -O2 -fPIC -c estimators.cc -o estimators.o
makepp: Scanning `/home/krayc/Desktop/genericCC/markoviancc.cc'
makepp: Scanning `/home/krayc/Desktop/genericCC/markoviancc.hh'
makepp: warning: can't locate file random.h, included from `/home/krayc/Desktop/genericCC/markoviancc.hh'
Include path [user] is:
  [including file's directory]
  /home/krayc/Desktop/genericCC/protobufs-default
  /home/krayc/Desktop/genericCC/udt
  /usr/local/include
  /usr/include
makepp: Scanning `/home/krayc/Desktop/genericCC/ccc.hh'
makepp: Scanning `/home/krayc/Desktop/genericCC/random.hh'
makepp: Scanning `/home/krayc/Desktop/genericCC/rtt-window.hh'
g++ -I./protobufs-default -I./udt -DHAVE_CONFIG_H -std=c++11 -pthread -pedantic -Wall -Wextra -Weffc++ -Werror -fno-default-inline -g -O2 -fPIC -c markoviancc.cc -o markoviancc.o
In file included from markoviancc.hh:10:0,
                 from markoviancc.cc:3:
random.hh:8:9: error: ‘mt19937’ in namespace ‘boost::random’ does not name a type
 typedef boost::random::mt19937 PRNG;
         ^
random.hh:10:8: error: ‘PRNG’ does not name a type
 extern PRNG & global_PRNG();
        ^
makepp: error: Failed to build target `/home/krayc/Desktop/genericCC/markoviancc.o' [1]
makepp: 3 files updated, 0 phony targets built and 1 target failed

Is there a clue to solve this? I am using Ubuntu 12.04, g++ version is 4.6.3. Is it possible that the g++ version is too old? But I am trying to run an experiment with it in Mininet, which only supports Ubuntu 12.04 (Linux kernel 3.13.0).

Thanks in advance!

Kuixi

Hi Kuixi,

This indeed a version issue which can be easily fixed. Here's what I did:

I tried reproducing your issue with Amazon AMI Ubuntu 12.04.1 LTS (Precise Pangolin) - Docker (ami-41cece28)

First thing I noticed was that g++ was outdated and didn't support C++11. I am surprised your build went that far at all. So I updated to g++-6 with
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install g++-6

I changed the g++ version in makepp by changing line 3 in makefile to be CXX := g++-6. I also changed g++ in line 31 to $(CXX) (pushed a commit to fix this)

Boost is also outdated, so install new versions as sudo apt-get install libboost1.48-dev libboost-python1.48-dev

Summary
Install g++-6 and libboost 1.48
Change line 3 of makepp to be CXX := g++-6

It works for me now. Let me know if you face further issues

makepp works now! Thanks you so much! <3