一 写在前面的话:

音频算法仿真过程中,本来是一个跑的好好地程序,突然间在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之后,马上好了。哈哈,看来是编译器捣的鬼啊。

四 反思:

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

ld: symbol(s) not found for architecture x86_64问题解决的更多相关文章

  1. Xcode调用旧版本库出现Undefined symbols for architecture x86_64: ld: symbol(s) not found for architecture x86_64

    问题:Undefined symbols for architecture x86_64:   ld: symbol(s) not found for architecture x86_64 问题原因 ...

  2. 模拟器运行报错:ld: symbol(s) not found for architecture x86_64

    模拟器运行报错: 报错信息如下: Undefined symbols for architecture x86_64: "_x264_encoder_open_142", refe ...

  3. iOS编译错误#ld: warning: ignoring file# 之 Undefined symbols for architecture x86_64 - ld: symbol(s) not found for architecture x86_64

    ld: warning: ignoring file xxxPath/libbaidumapapi.a, missing required architecture x86_64 in file xx ...

  4. mac 关于使用protobuf出现ld: symbol(s) not found for architecture x86_64的问题

    主要是编译时没有添加protobuf库文件 g++  -o Writer.o  lm.helloworld.pb.cc Writer.cpp -L/usr/local/lib -lprotobuf

  5. symbol(s) not found for architecture x86_64

    项目报错如下: ld: warning: ignoring file /xxxx/xxxx/ZBarSDK/libzbar.a ld: symbol(s) not found for architec ...

  6. Undefined symbols for architecture armv7: "_OBJC_METACLASS_$_ _OBJC_CLASS_$_ ld: symbol(s) not found for architecture armv7错误

    Undefined symbols for architecture armv7:  "_OBJC_METACLASS_$_MWPhotoBrowser", referenced ...

  7. cmake: error: symbol(s) not found for architecture x86_64 mac os 使用boost asio

    最近在使用boost的asio库,在mac osx 上编写网络服务程序报错: :-1: error: symbol(s) not found for architecture x86_64 然后在CM ...

  8. symbol(s) not found for architecture x86_64 之 linker command failed with exit code 1 (use -v to see invocation)解决方案排查

    这样的错误 ,我的解决方案是, 第一种:   查看他说在 ****.o 中,你要查看这样的关键点,然后去查看,你 项目中有没有引进这样的文件,在项目中查找,看项目中有没有,如果没有那就是没添加进来,你 ...

  9. Qt: error: symbol(s) not found for architecture x86_64问题

    Mac上面报这个问题,结果是因为.h文件有函数没有实现.

  10. Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_The49DayPersonalFullscreenGiftModel", referenced from: objc-class-ref in The49DayPersonalRoomGiftModel.o ld: symbol(s) not found for a

    Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_The49DayPersonalFullscreenGiftModel&q ...

随机推荐

  1. Properties集合的使用

    Properties集合是唯一一个可以和IO流相结合的集合 可以将集合中的数据持久化存储,也可以将硬盘上的数据加载到该集合中. 1 Properties集合添加.遍历 1 private static ...

  2. centos离线安装chrony

    环境 CentOS Linux release 7.9.2009 (Core) 工具 chrony-2.2.1.tar.gz 下载地址:https://download.tuxfamily.org/c ...

  3. 基本数据类型(primitive type)

    数据类型 数据类型分为基本数据类型(primitive type)和引用数据类型(reference type) 基本数据类型(primitive type) 数值类型 整数类型 浮点类型 字符类型 ...

  4. java获取最近12个月月份

    最近在做一个换电站管理的项目,其中有一个大屏折线图.要求计算近12个月的数据.所以,就需要写一个生成近12个月月份的算法.算法如下. 一:编写生成近12个月月份的算法 二:编写判断当天是否是月初的算法 ...

  5. Java并发(六)----线程start、run、state方法

    1.start 与 run 调用 run public static void main(String[] args) {    Thread t1 = new Thread("t1&quo ...

  6. 蓝鲸单机离线部署:app_mgr组件安装失败解决

    之前在腾讯蓝鲸智云-单机离线部署测试中,遇到了几个安装问题,本文记录下3.2 app_mgr组件安装失败 的解决过程,因为这个问题卡了很久(可能也是因为笔者对python相关知识和蓝鲸产品不够熟悉), ...

  7. Linux通过fdisk或者parted进行磁盘分区,然后格式化和挂载磁盘

    磁盘分区是Linux的常用命令,其中fdisk和parted命令最为常用.但是当磁盘大于2T时,fdisk只能分到2T. 比如4T的磁盘,fdisk只能分2T的主分区出来,parted可以直接分成4T ...

  8. ABC 333

    ABCDE 赛时 AC. F 列方程:\(f_{i,j}\) 表示有 \(i\) 个人,第 \(j\) 个人最终活下来的概率. \(f_{i,1}=\dfrac{1}{2}f_{i,i}\),因为只有 ...

  9. JS Leetcode 278. 第一个错误的版本 题解分析

    壹 ❀ 引 本题来自LeetCode的278. 第一个错误的版本,难度简单,端午节就应该做点容易的题目缓解心情,题目描述如下: 你是产品经理,目前正在带领一个团队开发新的产品.不幸的是,你的产品的最新 ...

  10. NC13885 Music Problem

    题目链接 题目 题目描述 Listening to the music is relax, but for obsessive(强迫症), it may be unbearable. HH is an ...