Chord in NS3 - Issues Getting it Running

388 views
Skip to first unread message

Liam McGhee

unread,
Jul 28, 2014, 2:08:44 PM7/28/14
to ns-3-...@googlegroups.com
I'm trying to implement chord in ns3 but I am having troubling getting the code that is already out there for it to run. I cloned the code from this repository: http://code.nsnam.org/gillh/ns-3-chord/ but when I went to build it with ./waf (after using ./waf configure) it failed to build and gave me the following error:

Waf: Entering directory `/Users/Dekabal/Desktop/ns3workspace-chord/ns-allinone-3.19/ns-3.19/ns-3-chord/build'
[ 11/982] ns3header: src/core/log.h -> build/debug/ns3/log.h
[390/982] cxx: src/core/log.cc -> build/debug/src/core/log_1.o
[394/982] cxx: src/core/object-base.cc -> build/debug/src/core/object-base_1.o
[396/982] cxx: src/core/object.cc -> build/debug/src/core/object_1.o
[400/982] cxx: src/core/command-line.cc -> build/debug/src/core/command-line_1.o
[402/982] cxx: src/core/attribute.cc -> build/debug/src/core/attribute_1.o
[414/982] cxx: src/core/config.cc -> build/debug/src/core/config_1.o
[415/982] cxx: src/core/callback.cc -> build/debug/src/core/callback_1.o
[416/982] cxx: src/core/names.cc -> build/debug/src/core/names_1.o
In file included from ../src/core/callback.cc:42:
../src/core/log.h:339: error: typedef ‘ns3::ns3::LogTimePrinter’ is initialized (use __typeof__ instead)
../src/core/log.h:339: error: ‘ostream’ is not a member of ‘ns3::std’
../src/core/log.h:339: error: ‘os’ was not declared in this scope
../src/core/log.h:340: error: typedef ‘ns3::ns3::LogNodePrinter’ is initialized (use __typeof__ instead)
../src/core/log.h:340: error: ‘ostream’ is not a member of ‘ns3::std’
../src/core/log.h:340: error: ‘os’ was not declared in this scope
../src/core/log.h:342: error: variable or field ‘LogSetTimePrinter’ declared void
../src/core/log.h:342: error: ‘LogTimePrinter’ was not declared in this scope
../src/core/log.h:343: error: ‘LogTimePrinter’ does not name a type
../src/core/log.h:345: error: variable or field ‘LogSetNodePrinter’ declared void
../src/core/log.h:345: error: ‘LogNodePrinter’ was not declared in this scope
../src/core/log.h:346: error: ‘LogNodePrinter’ does not name a type
../src/core/log.h:364: error: expected class-name before ‘{’ token
../src/core/log.h:366: error: ISO C++ forbids declaration of ‘ostream’ with no type
../src/core/log.h:366: error: invalid use of ‘::’
../src/core/log.h:366: error: expected ‘;’ before ‘&’ token
../src/core/log.h:368: error: expected `
)' before ‘&’ token
../src/core/log.h: In member function ‘ns3::ns3::ParameterLogger& ns3::ns3::ParameterLogger::operator<<(T)’:
../src/core/log.h:376: error: ‘m_os’ was not declared in this scope
../src/core/callback.cc: At global scope:
../src/core/callback.cc:44: error: ‘string’ in namespace ‘ns3::std’ does not name a type
[425/982] cxx: src/core/unix-system-thread.cc -> build/debug/src/core/unix-system-thread_1.o
Waf: Leaving directory `/Users/Dekabal/Desktop/ns3workspace-chord/ns-allinone-3.19/ns-3.19/ns-3-chord/build'

Build failed
 
-> task failed (err #1):
   
{task: cxx callback.cc -> callback_1.o}

The code that it is failing at initially looks like this:

namespace ns3 {

#include <iostream>

/**
 * \ingroup logging
 *
 * Print the list of logging messages available.
 * Same as running your program with the NS_LOG environment
 * variable set as NS_LOG=print-list
 */

void LogComponentPrintList (void);

typedef void (*LogTimePrinter) (std::ostream &os);
typedef void (*LogNodePrinter) (std::ostream &os);

void LogSetTimePrinter (LogTimePrinter);
LogTimePrinter LogGetTimePrinter(void);

void LogSetNodePrinter (LogNodePrinter);
LogNodePrinter LogGetNodePrinter(void);

Does anyone have any idea about how to fix this or if it is fixable? My knowledge of c++ isn't that extensive and i've tried removing the namespace declarations and moving the offending lines out of the namespace but it causes he code to break in many of files instead of just log.h.

Konstantinos

unread,
Jul 28, 2014, 2:21:40 PM7/28/14
to ns-3-...@googlegroups.com
Hi,

There was a similar error/question in this post https://groups.google.com/d/msg/ns-3-users/rMFdzzOz8s4/FGYX_8gYCH8J
The solution as explained in the reply was to put the header file definition outside of the ns-3 namespace.

i.e. in your case instead of 

namespace ns3 {
#include <iostream>
...

have 

#include <iostream>
namespace ns3 {
...


Also note, that the ns-3 tree you try to use is very old and porting it into later releases (3.19 or I would suggest 3.20 which is the current) might give more errors due to the changes in the API.

Regards,
K.

Liam McGhee

unread,
Jul 28, 2014, 2:40:06 PM7/28/14
to ns-3-...@googlegroups.com
Thanks for the quick reply. I tried this but it results in the same error.

Liam McGhee

unread,
Jul 29, 2014, 10:28:59 AM7/29/14
to ns-3-...@googlegroups.com
I was able to solve the issue. To fix this problem, you need to change all uses of std:: in src/core/log.h and in src/core/callback.cc to ::std:: and comment out examples/routing/nms-p2p-nix.cc.
Reply all
Reply to author
Forward
0 new messages