Discussion:
Do I need precompil or any?
non
2018-11-29 06:48:04 UTC
Permalink
Hi everyone.

I try to build mesh-net work on ns3.26.
But it isn't work.
I think it is bad to code.

Do I need precompil for header and code?

Would you help me?

Thank you.

------Hierarchy------
ns 3.26 --- scratch--- exp06-simpleMesh.cc
---simpleMeshLib.h
---simpleMeshLib.cc


------error------

Undefined symbols for architecture x86_64:

"_main", referenced from:

implicit entry/start for main executable

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see
invocation)


Undefined symbols for architecture x86_64:

"MeshDot11sSim::RunSim(int, char**)", referenced from:

_main in exp06-simpleMesh.cc.14.o

"MeshDot11sSim::MeshDot11sSim()", referenced from:

_main in exp06-simpleMesh.cc.14.o

"vtable for MeshDot11sSim", referenced from:

MeshDot11sSim::~MeshDot11sSim() in exp06-simpleMesh.cc.14.o

NOTE: a missing vtable usually means the first non-inline virtual member
function has no definition.

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see
invocation)



-----code(exp06-simpleMesh.cc)-----
12 int main (int argc, char *argv[])
13 {
14 MeshDot11sSim sim;
15 ns3::PacketMetadata::Enable ();
16
17 sim.RunSim(argc, argv);
18
19 return 0;
20 }

-----code(simpleMeshLib.h)-----

class MeshDot11sSim
{
public:
// Init test
MeshDot11sSim ();

//private:
uint32_t m_xSize; //x size of the grid
uint32_t m_ySize; //y size of the grid
double m_step; //separation between nodes
double m_randomStart;
double m_totalTime;
uint16_t m_packetSize;
uint32_t m_nIfaces;
bool m_chan;
std::string m_txrate;
std::string m_root;
bool m_showRtable;

//to calculate the lenght of the simulation
float m_timeTotal, m_timeStart, m_timeEnd;

// List of network nodes
NodeContainer meshNodes;
NodeContainer staNodes;
Ptr<Node> *n;
Ptr<Node> bgr;

// List of all mesh point devices
NetDeviceContainer meshDevices;
NetDeviceContainer p2pDevices;

// MeshHelper. Report is not static methods
MeshHelper mesh;

//private:
// Run test
virtual void RunSim (int argc, char **argv);

// Configure test from command line arguments
virtual void Configure (int argc, char ** argv);

// Create nodes and setup their mobility

-----code(simpleMeshLib.cc)-----
void
MeshDot11sSim::RunSim (int argc, char *argv[])
{
NS_LOG_FUNCTION(this);

Configure (argc, argv);

// use ConfigStore
// following default configuration are same to
// ./waf --run "exp06-simpleMesh --ns3::ConfigStore::Mode=Save
// --ns3::ConfigStore::Filename=config.txt"
std::string cf = std::string(PROG_DIR) + "config.txt";
Config::SetDefault ("ns3::ConfigStore::Filename", StringValue (cf));
Config::SetDefault ("ns3::ConfigStore::FileFormat", StringValue
("RawText"));
Config::SetDefault ("ns3::ConfigStore::Mode", StringValue ("Save"));
ConfigStore config;
config.ConfigureDefaults ();

CreateTopologyNodes ();
ConfigureMeshLayer();
InstallInternetStack ();

//SetUpUdpApplication();
--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+***@googlegroups.com.
To post to this group, send email to ns-3-***@googlegroups.com.
Visit this group at https://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.
Rob Kers
2018-11-29 08:22:51 UTC
Permalink
Hi!

Did you add you .h and .cc files to .waf config files? Otherwise the WAF
build tool does not know about your files and wont link them.

" clang: error: linker command failed with exit code 1 (use -v to see
invocation)"
indicates a linking problem.
Post by non
Hi everyone.
I try to build mesh-net work on ns3.26.
But it isn't work.
I think it is bad to code.
Do I need precompil for header and code?
Would you help me?
Thank you.
------Hierarchy------
ns 3.26 --- scratch--- exp06-simpleMesh.cc
---simpleMeshLib.h
---simpleMeshLib.cc
------error------
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
_main in exp06-simpleMesh.cc.14.o
_main in exp06-simpleMesh.cc.14.o
MeshDot11sSim::~MeshDot11sSim() in exp06-simpleMesh.cc.14.o
NOTE: a missing vtable usually means the first non-inline virtual
member function has no definition.
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
-----code(exp06-simpleMesh.cc)-----
12 int main (int argc, char *argv[])
13 {
14 MeshDot11sSim sim;
15 ns3::PacketMetadata::Enable ();
16
17 sim.RunSim(argc, argv);
18
19 return 0;
20 }
-----code(simpleMeshLib.h)-----
class MeshDot11sSim
{
// Init test
MeshDot11sSim ();
uint32_t m_xSize; //x size of the grid
uint32_t m_ySize; //y size of the grid
double m_step; //separation between nodes
double m_randomStart;
double m_totalTime;
uint16_t m_packetSize;
uint32_t m_nIfaces;
bool m_chan;
std::string m_txrate;
std::string m_root;
bool m_showRtable;
//to calculate the lenght of the simulation
float m_timeTotal, m_timeStart, m_timeEnd;
// List of network nodes
NodeContainer meshNodes;
NodeContainer staNodes;
Ptr<Node> *n;
Ptr<Node> bgr;
// List of all mesh point devices
NetDeviceContainer meshDevices;
NetDeviceContainer p2pDevices;
// MeshHelper. Report is not static methods
MeshHelper mesh;
// Run test
virtual void RunSim (int argc, char **argv);
// Configure test from command line arguments
virtual void Configure (int argc, char ** argv);
// Create nodes and setup their mobility
-----code(simpleMeshLib.cc)-----
void
MeshDot11sSim::RunSim (int argc, char *argv[])
{
NS_LOG_FUNCTION(this);
Configure (argc, argv);
// use ConfigStore
// following default configuration are same to
// ./waf --run "exp06-simpleMesh --ns3::ConfigStore::Mode=Save
// --ns3::ConfigStore::Filename=config.txt"
std::string cf = std::string(PROG_DIR) + "config.txt";
Config::SetDefault ("ns3::ConfigStore::Filename", StringValue (cf));
Config::SetDefault ("ns3::ConfigStore::FileFormat", StringValue
("RawText"));
Config::SetDefault ("ns3::ConfigStore::Mode", StringValue ("Save"));
ConfigStore config;
config.ConfigureDefaults ();
CreateTopologyNodes ();
ConfigureMeshLayer();
InstallInternetStack ();
//SetUpUdpApplication();
--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+***@googlegroups.com.
To post to this group, send email to ns-3-***@googlegroups.com.
Visit this group at https://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.
'pdbarnes' via ns-3-users
2018-11-29 13:07:16 UTC
Permalink
That’s true in modules in src, but not in scratch. In scratch there are two ways to arrange your code.

For single .cc files with a main() function just put them in scratch. When you want to spread your code over multiple.cc files, as in this case, you should put them all in a subdirectory of scratch. You don’t need to edit any wscript files. These two cases are explained in the tutorial.

Peter
--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+***@googlegroups.com.
To post to this group, send email to ns-3-***@googlegroups.com.
Visit this group at https://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.
Loading...