memset, memcpy не ссылка

#c 11 #ns-3

Вопрос:

Я хочу бежать first.cc (пример в библиотеке ns3 введите описание ссылки здесь, моделирование сети) в ubuntu последней версии 21, gcc версии 9.3.0
Вот CMakeLists.txt содержание:

 cmake_minimum_required(VERSION 3.15)
project(cmake-demo LANGUAGES CXX)
SET(CMAKE_CXX_COMPILER "g  ")
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(SOURCE tutorial/first.cc)
include_directories(
  "usr/include"
  "/home/quan/ns-allinone-3.29/ns-3.29/build"
   "/home/quan/ns-allinone-3.29/ns-3.29/build/ns3"
)
link_directories(
"/home/quan/ns-allinone-3.29/ns-3.29/build/lib"
 )
add_executable(${PROJECT_NAME} ${SOURCE})
 

вот небольшой пример кода

 #include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/internet-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/applications-module.h"

using namespace ns3;

NS_LOG_COMPONENT_DEFINE ("FirstScriptExample");

int
main (int argc, char *argv[])
{
   CommandLine cmd;
   cmd.Parse (argc, argv);

   Time::SetResolution (Time::NS);
   LogComponentEnable ("UdpEchoClientApplication", LOG_LEVEL_INFO);
   LogComponentEnable ("UdpEchoServerApplication", LOG_LEVEL_INFO);

   NodeContainer nodes;
   nodes.Create (2);

   PointToPointHelper pointToPoint;
   pointToPoint.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
   pointToPoint.SetChannelAttribute ("Delay", StringValue ("2ms"));

   NetDeviceContainer devices;
   devices = pointToPoint.Install (nodes);

   InternetStackHelper stack;
   stack.Install (nodes);

   Ipv4AddressHelper address;
   address.SetBase ("10.1.1.0", "255.255.255.0");

   Ipv4InterfaceContainer interfaces = address.Assign (devices);

   UdpEchoServerHelper echoServer (9);

   ApplicationContainer serverApps = echoServer.Install (nodes.Get (1));
   serverApps.Start (Seconds (1.0));
   serverApps.Stop (Seconds (10.0));

   UdpEchoClientHelper echoClient (interfaces.GetAddress (1), 9);
   echoClient.SetAttribute ("MaxPackets", UintegerValue (1));
   echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.0)));
   echoClient.SetAttribute ("PacketSize", UintegerValue (1024));

   ApplicationContainer clientApps = echoClient.Install (nodes.Get (0));
   clientApps.Start (Seconds (2.0));
   clientApps.Stop (Seconds (10.0));

   Simulator::Run ();
   Simulator::Destroy ();
   return 0;
 }
 

но когда я строю этот пример, я получаю некоторые ошибки в memset, функции memcpy не ссылаются
здесь на ошибки:

         [main] Building folder: examples 
    [build] Starting build
    [proc] Executing command: /usr/bin/cmake --build /home/quan/ns-allinone-3.29/ns-3.29/examples/build --config Debug --target all -j 18 --
    [build] [ 50%] Building CXX object CMakeFiles/cmake-demo.dir/tutorial/first.cc.o
    [build] In file included from /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/hash-function.h:24,
    [build]                  from /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/hash.h:29,
    [build]                  from /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/type-id.h:29,
    [build]                  from /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/object-base.h:23,
    [build]                  from /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/object.h:29,
    [build]                  from /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/scheduler.h:25,
    [build]                  from /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/calendar-scheduler.h:24,
    [build]                  from /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/core-module.h:19,
    [build]                  from /home/quan/ns-allinone-3.29/ns-3.29/examples/tutorial/first.cc:17:
    [build] /usr/include/c  /9/cstring:77:11: error: ‘::memchr’ has not been declared
    [build]    77 |   using ::memchr;
    [build]       |           ^~~~~~
    [build] /usr/include/c  /9/cstring:78:11: error: ‘::memcmp’ has not been declared
    [build]    78 |   using ::memcmp;
    [build]       |           ^~~~~~
    [build] /usr/include/c  /9/cstring:79:11: error: ‘::memcpy’ has not been declared
    [build]    79 |   using ::memcpy;
    [build]       |           ^~~~~~
    [build] /usr/include/c  /9/cstring:80:11: error: ‘::memmove’ has not been declared
    [build]    80 |   using ::memmove;
    [build]       |           ^~~~~~~
    [build] /usr/include/c  /9/cstring:81:11: error: ‘::memset’ has not been declared
    [build]    81 |   using ::memset;
    [build]       |           ^~~~~~
    [build] /usr/include/c  /9/cstring:82:11: error: ‘::strcat’ has not been declared
    [build]    82 |   using ::strcat;
    [build]       |           ^~~~~~
    [build] /usr/include/c  /9/cstring:83:11: error: ‘::strcmp’ has not been declared
    [build]    83 |   using ::strcmp;
    [build]       |           ^~~~~~
    [build] /usr/include/c  /9/cstring:84:11: error: ‘::strcoll’ has not been declared
    [build]    84 |   using ::strcoll;
    [build]       |           ^~~~~~~
    [build] /usr/include/c  /9/cstring:85:11: error: ‘::strcpy’ has not been declared
    [build]    85 |   using ::strcpy;
    [build]       |           ^~~~~~
    [build] /usr/include/c  /9/cstring:86:11: error: ‘::strcspn’ has not been declared
    [build]    86 |   using ::strcspn;
    [build]       |           ^~~~~~~
    [build] /usr/include/c  /9/cstring:87:11: error: ‘::strerror’ has not been declared
    [build]    87 |   using ::strerror;
    [build]       |           ^~~~~~~~
    [build] /usr/include/c  /9/cstring:88:11: error: ‘::strlen’ has not been declared
    [build]    88 |   using ::strlen;
    [build]       |           ^~~~~~
    [build] /usr/include/c  /9/cstring:89:11: error: ‘::strncat’ has not been declared
    [build]    89 |   using ::strncat;
    [build]       |           ^~~~~~~
    [build] /usr/include/c  /9/cstring:90:11: error: ‘::strncmp’ has not been declared
    [build]    90 |   using ::strncmp;
    [build]       |           ^~~~~~~
    [build] /usr/include/c  /9/cstring:91:11: error: ‘::strncpy’ has not been declared
    [build]    91 |   using ::strncpy;
    [build]       |           ^~~~~~~
    [build] /usr/include/c  /9/cstring:92:11: error: ‘::strspn’ has not been declared
    [build]    92 |   using ::strspn;
    [build]       |           ^~~~~~
    [build] /usr/include/c  /9/cstring:93:11: error: ‘::strtok’ has not been declared
    [build]    93 |   using ::strtok;
    [build]       |           ^~~~~~
    [build] /usr/include/c  /9/cstring:94:11: error: ‘::strxfrm’ has not been declared
    [build]    94 |   using ::strxfrm;
    [build]       |           ^~~~~~~
    [build] /usr/include/c  /9/cstring:95:11: error: ‘::strchr’ has not been declared
    [build]    95 |   using ::strchr;
    [build]       |           ^~~~~~
    [build] /usr/include/c  /9/cstring:96:11: error: ‘::strpbrk’ has not been declared
    [build]    96 |   using ::strpbrk;
    [build]       |           ^~~~~~~
    [build] /usr/include/c  /9/cstring:97:11: error: ‘::strrchr’ has not been declared
    [build]    97 |   using ::strrchr;
    [build]       |           ^~~~~~~
    [build] /usr/include/c  /9/cstring:98:11: error: ‘::strstr’ has not been declared
    [build]    98 |   using ::strstr;
    [build]       |           ^~~~~~
    [build] In file included from /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/hash.h:29,
    [build]                  from /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/type-id.h:29,
    [build]                  from /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/object-base.h:23,
    [build]                  from /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/object.h:29,
    [build]                  from /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/scheduler.h:25,
    [build]                  from /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/calendar-scheduler.h:24,
    [build]                  from /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/core-module.h:19,
    [build]                  from /home/quan/ns-allinone-3.29/ns-3.29/examples/tutorial/first.cc:17:
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/hash-function.h: In member function ‘virtual uint32_t ns3::Hash::Function::Hash64::GetHash32(const char*, std::size_t)’:
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/hash-function.h:169:5: error: ‘memcpy’ was not declared in this scope
    [build]   169 |     memcpy (amp;hash32, amp;hash64, sizeof (hash32));
    [build]       |     ^~~~~~
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/hash-function.h:25:1: note: ‘memcpy’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
    [build]    24 | #include <cstring>  // memcpy
    [build]       | #include <cstring>
    [build]    25 | #include "simple-ref-count.h"
    [build] In file included from /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/address-utils.h:23,
    [build]                  from /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/network-module.h:10,
    [build]                  from /home/quan/ns-allinone-3.29/ns-3.29/examples/tutorial/first.cc:18:
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/buffer.h: In member function ‘void ns3::Buffer::Iterator::WriteU8(uint8_t, uint32_t)’:
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/buffer.h:893:12: error: ‘memset’ is not a member of ‘std’
    [build]   893 |       std::memset (amp;(m_data[m_current]), data, len);
    [build]       |            ^~~~~~
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/buffer.h:899:12: error: ‘memset’ is not a member of ‘std’
    [build]   899 |       std::memset (buffer, data, len);
    [build]       |            ^~~~~~
    [build] In file included from /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/address-utils.h:25,
    [build]                  from /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/network-module.h:10,
    [build]                  from /home/quan/ns-allinone-3.29/ns-3.29/examples/tutorial/first.cc:18:
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/ipv6-address.h: In function ‘bool ns3::operator==(const ns3::Ipv6Addressamp;, const ns3::Ipv6Addressamp;)’:
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/ipv6-address.h:591:17: error: ‘memcmp’ is not a member of ‘std’; did you mean ‘memchr’?
    [build]   591 |   return (!std::memcmp (a.m_address, b.m_address, 16));
    [build]       |                 ^~~~~~
    [build]       |                 memchr
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/ipv6-address.h: In function ‘bool ns3::operator!=(const ns3::Ipv6Addressamp;, const ns3::Ipv6Addressamp;)’:
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/ipv6-address.h:596:15: error: ‘memcmp’ is not a member of ‘std’; did you mean ‘memchr’?
    [build]   596 |   return std::memcmp (a.m_address, b.m_address, 16);
    [build]       |               ^~~~~~
    [build]       |               memchr
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/ipv6-address.h: In function ‘bool ns3::operator<(const ns3::Ipv6Addressamp;, const ns3::Ipv6Addressamp;)’:
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/ipv6-address.h:601:16: error: ‘memcmp’ is not a member of ‘std’; did you mean ‘memchr’?
    [build]   601 |   return (std::memcmp (a.m_address, b.m_address, 16) < 0);
    [build]       |                ^~~~~~
    [build]       |                memchr
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/ipv6-address.h: In function ‘bool ns3::operator==(const ns3::Ipv6Prefixamp;, const ns3::Ipv6Prefixamp;)’:
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/ipv6-address.h:606:17: error: ‘memcmp’ is not a member of ‘std’; did you mean ‘memchr’?
    [build]   606 |   return (!std::memcmp (a.m_prefix, b.m_prefix, 16));
    [build]       |                 ^~~~~~
    [build]       |                 memchr
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/ipv6-address.h: In function ‘bool ns3::operator!=(const ns3::Ipv6Prefixamp;, const ns3::Ipv6Prefixamp;)’:
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/ipv6-address.h:611:15: error: ‘memcmp’ is not a member of ‘std’; did you mean ‘memchr’?
    [build]   611 |   return std::memcmp (a.m_prefix, b.m_prefix, 16);
    [build]       |               ^~~~~~
    [build]       |               memchr
    [build] In file included from /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/address-utils.h:27,
    [build]                  from /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/network-module.h:10,
    [build]                  from /home/quan/ns-allinone-3.29/ns-3.29/examples/tutorial/first.cc:18:
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/mac64-address.h: In function ‘bool ns3::operator==(const ns3::Mac64Addressamp;, const ns3::Mac64Addressamp;)’:
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/mac64-address.h:162:10: error: ‘memcmp’ was not declared in this scope
    [build]   162 |   return memcmp (a.m_address, b.m_address, 8) == 0;
    [build]       |          ^~~~~~
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/mac64-address.h:1:1: note: ‘memcmp’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
    [build]       | #include <cstring>
    [build]     1 | /* -*- Mode:C  ; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/mac64-address.h: In function ‘bool ns3::operator!=(const ns3::Mac64Addressamp;, const ns3::Mac64Addressamp;)’:
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/mac64-address.h:166:10: error: ‘memcmp’ was not declared in this scope
    [build]   166 |   return memcmp (a.m_address, b.m_address, 8) != 0;
    [build]       |          ^~~~~~
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/mac64-address.h:166:10: note: ‘memcmp’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/mac64-address.h: In function ‘bool ns3::operator<(const ns3::Mac64Addressamp;, const ns3::Mac64Addressamp;)’:
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/mac64-address.h:170:10: error: ‘memcmp’ was not declared in this scope
    [build]   170 |   return memcmp (a.m_address, b.m_address, 8) < 0;
    [build]       |          ^~~~~~
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/mac64-address.h:170:10: note: ‘memcmp’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
    [build] In file included from /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/address-utils.h:28,
    [build]                  from /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/network-module.h:10,
    [build]                  from /home/quan/ns-allinone-3.29/ns-3.29/examples/tutorial/first.cc:18:
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/mac48-address.h: In function ‘bool ns3::operator==(const ns3::Mac48Addressamp;, const ns3::Mac48Addressamp;)’:
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/mac48-address.h:205:10: error: ‘memcmp’ was not declared in this scope
    [build]   205 |   return memcmp (a.m_address, b.m_address, 6) == 0;
    [build]       |          ^~~~~~
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/mac48-address.h:1:1: note: ‘memcmp’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
    [build]       | #include <cstring>
    [build]     1 | /* -*- Mode:C  ; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/mac48-address.h: In function ‘bool ns3::operator!=(const ns3::Mac48Addressamp;, const ns3::Mac48Addressamp;)’:
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/mac48-address.h:209:10: error: ‘memcmp’ was not declared in this scope
    [build]   209 |   return memcmp (a.m_address, b.m_address, 6) != 0;
    [build]       |          ^~~~~~
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/mac48-address.h:209:10: note: ‘memcmp’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/mac48-address.h: In function ‘bool ns3::operator<(const ns3::Mac48Addressamp;, const ns3::Mac48Addressamp;)’:
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/mac48-address.h:213:10: error: ‘memcmp’ was not declared in this scope
    [build]   213 |   return memcmp (a.m_address, b.m_address, 6) < 0;
    [build]       |          ^~~~~~
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/mac48-address.h:213:10: note: ‘memcmp’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
    [build] In file included from /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/address-utils.h:29,
    [build]                  from /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/network-module.h:10,
    [build]                  from /home/quan/ns-allinone-3.29/ns-3.29/examples/tutorial/first.cc:18:
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/mac16-address.h: In function ‘bool ns3::operator==(const ns3::Mac16Addressamp;, const ns3::Mac16Addressamp;)’:
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/mac16-address.h:155:10: error: ‘memcmp’ was not declared in this scope
    [build]   155 |   return memcmp (a.m_address, b.m_address, 2) == 0;
    [build]       |          ^~~~~~
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/mac16-address.h:1:1: note: ‘memcmp’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
    [build]       | #include <cstring>
    [build]     1 | /* -*-  Mode: C  ; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/mac16-address.h: In function ‘bool ns3::operator!=(const ns3::Mac16Addressamp;, const ns3::Mac16Addressamp;)’:
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/mac16-address.h:159:10: error: ‘memcmp’ was not declared in this scope
    [build]   159 |   return memcmp (a.m_address, b.m_address, 2) != 0;
    [build]       |          ^~~~~~
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/mac16-address.h:159:10: note: ‘memcmp’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/mac16-address.h: In function ‘bool ns3::operator<(const ns3::Mac16Addressamp;, const ns3::Mac16Addressamp;)’:
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/mac16-address.h:163:10: error: ‘memcmp’ was not declared in this scope
    [build]   163 |   return memcmp (a.m_address, b.m_address, 2) < 0;
    [build]       |          ^~~~~~
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/mac16-address.h:163:10: note: ‘memcmp’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
    [build] In file included from /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/packet.h:27,
    [build]                  from /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/net-device.h:28,
    [build]                  from /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/node.h:29,
    [build]                  from /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/application.h:28,
    [build]                  from /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/application-container.h:26,
    [build]                  from /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/network-module.h:12,
    [build]                  from /home/quan/ns-allinone-3.29/ns-3.29/examples/tutorial/first.cc:18:
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/packet-metadata.h: In constructor ‘ns3::PacketMetadata::PacketMetadata(uint64_t, uint32_t)’:
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/packet-metadata.h:701:3: error: ‘memset’ was not declared in this scope
    [build]   701 |   memset (m_data->m_data, 0xff, 4);
    [build]       |   ^~~~~~
    [build] /home/quan/ns-allinone-3.29/ns-3.29/build/ns3/packet-metadata.h:29:1: note: ‘memset’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
    [build]    28 | #include "ns3/type-id.h"
    [build]       | #include <cstring>
    [build]    29 | #include "buffer.h"
    [build] make[2]: *** [CMakeFiles/cmake-demo.dir/build.make:63: CMakeFiles/cmake-demo.dir/tutorial/first.cc.o] Error 1
    [build] make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/cmake-demo.dir/all] Error 2
    [build] make: *** [Makefile:84: all] Error 2
    [build] Build finished with exit code 2
 

введите описание изображения здесь

Любое предложение поможет мне исправить это, заранее спасибо!

Комментарии:

1. Я смотрю string.h , где-то в каталоге ns3 есть файл, который конфликтует с системным и вызывает ошибки <cstring> . Возможно, у вас просто опечатка, "usr/include" и вам действительно нужно "/usr/include" сначала отсканировать ее и построить.h оттуда.

2. Я нашел в memory.h в usr/include/c /9 нет функций memset или memcpy

3. @dewaffled спасибо, я исправляю это, но эти ошибки все еще появляются

4. Поскольку вы не упомянули об этом, я отмечу, что в ns-3 уже есть работающая система сборки: waf. У него есть свои причуды, но это хорошо задокументировано в учебнике ns-3 . Вероятно, вам лучше использовать waf, чем заставлять cmake работать.

5. спасибо @Sagar за вашу рекомендацию!

Ответ №1:

Вам нужно удалить /home/quan/ns-allinone-3.29/ns-3.29/build/ns3 из путей включения. Глядя на примеры кодов, он всегда попадает ncs в путь, и вам не нужно его добавлять include_directories . Параметр string.h from ns3 конфликтует с параметром, определенным в STL

Комментарии:

1. Я попытался удалить /home/quan/ns-allinone-3.29/ns-3.29/build/ns3 из путей включения, но появилось еще больше ошибок, я также думаю, что в строке есть конфликты. h но не знаю, как это исправить

2. Существует ли оригинал до сих пор ?? Что такое новые ??

3. исходные ошибки исчезают, но появляются новые ошибки: неопределенная ссылка на ns3::CommandLine::CommandLine(),ns3::Time::SetResolution(ns3::Time::Unit),ns3::LogComponentEnable,….похоже, связано с модулями ns3

4. Я думаю, что первоначальная проблема, описанная в этом посте, решена, поэтому теперь вам нужно продолжить устранять проблемы с компоновщиком, включая связанные библиотеки