zoukankan      html  css  js  c++  java
  • C++基础 | 报错 << Mac上使用g++编译出错“Undefined symbols for architecture x86_64:” 错误解决办法

     搞了一下午,终于找到答案了!!再Mac上使用自带的g++编译使用opencv编写的图像代码,在使用图像数据结构时,使用IplImage和CvMat数据类型进行简单的加载、显示图像和两种数据的相互转换都没有错误,但只要使用Mat数据结构就出现下面的错误:

    Undefined symbols for architecture x86_64:
      "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long)", referenced from:
          _main in main.o
      "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()", referenced from:
          _main in main.o
      "std::terminate()", referenced from:
          ___clang_call_terminate in main.o
      "___cxa_begin_catch", referenced from:
          ___clang_call_terminate in main.o
      "___gxx_personality_v0", referenced from:
          _main in main.o
          Dwarf Exception Unwind Info (__eh_frame) in main.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make: *** [main] Error 1

    想了很多办法,终于看到有人提示:编译选项添加-lstdc++,即使用标准C++库,问题解决!

    来源

    https://blog.csdn.net/eric41050808/article/details/39502231

  • 相关阅读:
    Android 下拉刷新上啦加载SmartRefreshLayout + RecyclerView
    Maven 本地打war包
    数据库性能优化一
    SessionStateMode之Redis共享session
    SessionStateMode之SQL Server共享session
    iframe跨域
    Jenkins发布MVC应用程序
    Docker入门之一Docker在Window下安装
    Window下SVN服务器搭建以及客户端使用
    Window下Jenkins的安装
  • 原文地址:https://www.cnblogs.com/-saber/p/11620150.html
Copyright © 2011-2022 走看看