zoukankan      html  css  js  c++  java
  • ld: symbol(s) not found for architecture x86_64问题解决

    一 写在前面的话:

       音频算法仿真过程中,本来是一个跑的好好地程序,突然间在mac下就报错了,出现的错误是:

    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    神马错误?运行程序很多年,还是第一次见这种错误啊。到底是什么问题呢?

    二 解决思路:

       针对这种不是一下看出问题的地方,我就使用了简化法,看看到底是什么鬼。精简了很多代码,发现不是代码出了问题,而是编译器这块出了问题,外事不懂问谷歌,搜一下吧,也许能给你灵感了。

    果真如此,在一个小角落里,我发现了这段话:

    I had a similar warning/error/failure when I was simply trying to make an executable from two different object files (main.o and add.o). I was using the command:

    gcc -o exec main.o add.o

    But my program is a C++ program. Using the g++ compiler solved my issue:

    g++ -o exec main.o add.o

    I was always under the impression that gcc could figure these things out on its own. Apparently not. I hope this helps someone else searching for this error.

    三 解决方法:

       查看自己的Makefile文件,才发现这个是使用的g++,改一下试一下,把它改成gcc之后,马上好了。哈哈,看来是编译器捣的鬼啊。

    四 反思:

      这种问题,暴露了自身的基础知识还不够扎实啊,看来还要多多学习,多多学习。

  • 相关阅读:
    JAVA-Map学习
    javaweb--cc1分析(1)
    thinkphp5.0.24 unserialize
    Windows API hook技术
    javaweb-JNDI注入
    了解WMI
    了解PSexec
    Exchange- (CVE-2021-26855)SSRF分析
    递归-实现省市区三级联动
    golang random string
  • 原文地址:https://www.cnblogs.com/dylancao/p/13695303.html
Copyright © 2011-2022 走看看