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

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 请问不小心下载到了钓鱼软件怎么办?
  • ¥15 求国博抢票 求国博抢票 有的私
  • ¥50 swiftui @query 报错
  • ¥50 怎么解决刷卡或扫码后,点击软件输入框,win10屏幕键盘不会自动弹出的问题
  • ¥15 如何使用arcgispro的训练深度模型,发现water和nowater精度为0?(相关搜索:深度学习)
  • ¥20 matlab作业不太懂呀有问题能给个代码吗
  • ¥15 自制电路图为何无法驱动ESP01S?
  • ¥15 前端加access数据库
  • ¥15 ARCGIS 多值提取到点 ERROR 999999
  • ¥15 mysql异常断电, [MY-011971] [InnoDB]