一 写在前面的话:

音频算法仿真过程中,本来是一个跑的好好地程序,突然间在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. 【译】命名变得简单:AI 支持的重命名建议

    您是否曾经为命名一个变量.方法或类而挣扎过?找到表达性和简洁性之间的完美平衡了吗?您并不孤单.我们通过 GitHub Copilot Chat 扩展(需要订阅)在最新的 Visual Studio 预 ...

  2. CentOS7设置防火墙

    ①查看防火状态 systemctl status firewalld service iptables status ②暂时关闭防火墙 systemctl stop firewalld service ...

  3. python截取字符串(字符串切片)

    python中使用[]来截取字符串,语法: 字符串[起始位置:结束位置] 一.起始位置:结束位置 先看几个例子: s = 'python' print(s) #输出 python 直接输出字符串 #从 ...

  4. Redis的Java客户端-Jedis

    Redis的Java客户端-Jedis 在Redis官网中提供了各种语言的客户端,地址:https://redis.io/docs/clients/ 其中Java客户端也包含很多: 标记为的就是推荐使 ...

  5. NC19325 游戏

    题目链接 题目 题目描述 BLUESKY007,fengxunling和dreagonm三个人发现了一个像素游戏,这款神奇的游戏每次会生成一个nxm的网格,其中每一个格子都被随机染色为R,G,B三种颜 ...

  6. NC14704 美味菜肴

    题目链接 题目 题目描述 小明是个大厨,早上起来他开始一天的工作.他所在的餐厅每天早上都会买好 \(n\) 件食材(每种食材的数量可以视为无限),小明从到达餐厅开始就连续工作 \(T\) 时间.每道菜 ...

  7. IPNS和DNSLink的使用说明

    IPNS和DNSLink的使用说明 IPNS说明 IPNS全称InterPlanetary Name System,就是IPFS下的一个名称解析系统,类似于互联网的DNS,但是与DNS不同的是,IPN ...

  8. java集成华为云obs上传下载实战

    说明 最近项目上需要开发一个服务去和华为云OBS集成获取一些业务上的文件,此处记录一下简单的java集成obs的入门,希望对大家快速入门有所帮助:) 实现效果 上传对象 下载到本地 操作步骤 1.开通 ...

  9. win32-FileTimeToSystemTime的使用

    #include <Windows.h> #include <iostream> #include <string> #pragma warning(disable ...

  10. git回退至指定版本,并更新远程仓库

    1. git log   查到commit记录 2.复制 commit 后面的id 3. git reset --hard  commit 后面的id   // 回退 4. 强制更新远程仓库  git ...