一 写在前面的话:

音频算法仿真过程中,本来是一个跑的好好地程序,突然间在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. Java并发编程面试题

    Synchronized 用过吗,其原理是什么? Synchronized是jvm实现的一种互斥同步访问方式,底层是基于对象的监视器monitor实现的. 被synchronize修饰的代码在反编译后 ...

  2. 深空物联网通信中视频流的智能多路TCP拥塞控制|文献阅读|文献分析和学习|拥塞控制|MPTCP|SVC

    前言 那么这里博主先安利一些干货满满的专栏了! 首先是博主的高质量博客的汇总,这个专栏里面的博客,都是博主最最用心写的一部分,干货满满,希望对大家有帮助. 高质量博客汇总https://blog.cs ...

  3. 【链表】单链表的介绍和基本操作(C语言实现)【保姆级别详细教学】

    单链表 文章目录 前言 单链表基本介绍 基本结构 与顺序表的区别以及学习单链表的必要性 单链表的实现 结点的定义以及头指针的创建 单链表的遍历(打印接口的实现)[重点] 开辟结点接口 尾插接口 尾删接 ...

  4. 【奶奶看了都会】云服务器部署开源ChatGLM-6B,让你也能拥有自己的ChatGPT

    1.背景 大家好啊,我是小卷. 最近ChatGPT不仅发布了GPT-4,而且解除封印可以联网了.不得不赞叹AI更新迭代的速度真快,都跟不上节奏了.但是大家也注意到了吧,随着ChatGPT的每次更新,O ...

  5. Sea-Search03总结&&un finish

    使用到的设计模式 Facade门面模式 为何使用? 在搜索项目中,由于使用Mvc架构且数据库中各种不同类型的数据源并没有放在同一张表,于是我们不可避免的在Controller中需要注入多个servic ...

  6. Hive分区和分桶的区别

    1.前言 Hive的分区和分桶都是细化数据管理,加快数据查询和分析,两者有什么区别呢?下面讲解一下分区和分桶的原理. 2.分区 (1)分区原理 Hive的分区表可以有一个或多个分区键,用于确定数据的存 ...

  7. 文心一言 VS 讯飞星火 VS chatgpt (198)-- 算法导论14.3 6题

    六.用go语言,说明如何来维护一个支持操作MIN-GAP的一些数的动态集Q,使得该操作能给出Q中两个最接近的数之间的差值.例如,Q=(1,5,9,15,18,22),则MIN-GAP返回18-15=3 ...

  8. 如何做好一个基础的搜索功能?记一个因客户大数据量而导致的后发先至Bug

    壹 ❀ 引 上篇文章算是开了一个新系列,因为工作缘故,我基本每天都在跟各式各样的bug打交道.其实站在一个开发的角度,我想每个人应该都更喜欢创造新代码,创造新bug,而不是每天都泡在茫茫代码海洋中定位 ...

  9. Python 装饰器解析(一)

    装饰器用于在源码中"标记"函数,以增强函数的行为. 我们先来看下面的例子,现有一个求和函数add,现在要求统计函数执行的时长 def add(a, b): print(a+b) 最 ...

  10. Android里使用AspectJ实现AOP

     前言 Aspectj提供一种在字符串里编程的模式,即在字符串里写函数,然后程序启动的时候会动态的把字符串里的函数给执行了. 例如: "execution(* *(..))" 这里 ...