猩猩不会写代码 2021-05-18 14:59 采纳率: 100%
浏览 79
已采纳

NS3中使用openCV的问题

本人在用ns3做wifi网络图片发送的问题,在用openCV读取和画图时报错

usr/bin/ld: scratch/PtoP.cc.11.o: in function `send(ns3::Ptr<ns3::Socket>)':
/home/cht/tarballs/ns-allinone-3.33/ns-3.33/build/../scratch/PtoP.cc:44: undefined reference to `cv::imread(cv::String const&, int)'
/usr/bin/ld: /home/cht/tarballs/ns-allinone-3.33/ns-3.33/build/../scratch/PtoP.cc:47: undefined reference to `cv::imencode(cv::String const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator<unsigned char> >&, std::vector<int, std::allocator<int> > const&)'
/usr/bin/ld: scratch/PtoP.cc.11.o: in function `RecvString(ns3::Ptr<ns3::Socket>)':
/home/cht/tarballs/ns-allinone-3.33/ns-3.33/build/../scratch/PtoP.cc:84: undefined reference to `cv::imdecode(cv::_InputArray const&, int)'
/usr/bin/ld: /home/cht/tarballs/ns-allinone-3.33/ns-3.33/build/../scratch/PtoP.cc:86: undefined reference to `cv::imshow(cv::String const&, cv::_InputArray const&)'
/usr/bin/ld: scratch/PtoP.cc.11.o: in function `cv::String::String(char const*)':
/usr/local/include/opencv2/core/cvstd.hpp:602: undefined reference to `cv::String::allocate(unsigned long)'
/usr/bin/ld: scratch/PtoP.cc.11.o: in function `cv::String::~String()':
/usr/local/include/opencv2/core/cvstd.hpp:648: undefined reference to `cv::String::deallocate()'
/usr/bin/ld: scratch/PtoP.cc.11.o: in function `cv::String::operator=(cv::String const&)':
/usr/local/include/opencv2/core/cvstd.hpp:656: undefined reference to `cv::String::deallocate()'
/usr/bin/ld: scratch/PtoP.cc.11.o: in function `cv::Mat::Mat(int, int, int, void*, unsigned long)':
/usr/local/include/opencv2/core/mat.inl.hpp:579: undefined reference to `cv::error(int, cv::String const&, char const*, char const*, int)'
/usr/bin/ld: /usr/local/include/opencv2/core/mat.inl.hpp:592: undefined reference to `cv::error(int, cv::String const&, char const*, char const*, int)'
/usr/bin/ld: /usr/local/include/opencv2/core/mat.inl.hpp:599: undefined reference to `cv::Mat::updateContinuityFlag()'
/usr/bin/ld: scratch/PtoP.cc.11.o: in function `cv::Mat::~Mat()':
/usr/local/include/opencv2/core/mat.inl.hpp:774: undefined reference to `cv::fastFree(void*)'
/usr/bin/ld: scratch/PtoP.cc.11.o: in function `cv::Mat::release()':
/usr/local/include/opencv2/core/mat.inl.hpp:886: undefined reference to `cv::Mat::deallocate()'
collect2: error: ld returned 1 exit status

在网上查资料说是缺少动态链接库(编译OpenCV文件(undefined reference to `cv::imread(cv::String const&, int)')_秃头队长-CSDN博客),运行时使用

g++ `pkg-config --cflags opencv` -g main.cpp `pkg-config --libs opencv`

我在ns3外面确实用这种方法成功了,但是在ns3里使用./waf 来运行,不知道该怎么办

希望有在ns3里用过openCV的大佬救救我,急!!

  • 写回答

4条回答 默认 最新

  • CSDN专家-Time 2021-05-18 15:09
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。
  • ¥20 CST怎么把天线放在座椅环境中并仿真
  • ¥15 任务A:大数据平台搭建(容器环境)怎么做呢?
  • ¥15 YOLOv8obb获取边框坐标时报错AttributeError: 'NoneType' object has no attribute 'xywhr'
  • ¥15 r语言神经网络自变量重要性分析
  • ¥15 基于双目测规则物体尺寸
  • ¥15 wegame打不开英雄联盟
  • ¥15 公司的电脑,win10系统自带远程协助,访问家里个人电脑,提示出现内部错误,各种常规的设置都已经尝试,感觉公司对此功能进行了限制(我们是集团公司)
  • ¥15 救!ENVI5.6深度学习初始化模型报错怎么办?