linker command failed with exit code 1 (use -v to see invocation)解决办法
来源:互联网 发布:阿里云数据价格 编辑:程序博客网 时间:2024/05/20 00:16
问题如下:
报错信息显示是连接时发生了错误,并且可以看到有编译后产生的目标文件如AACPlayer.o等,也证明编译过程没有出现问题。
网上找了好多文章,大部分说的都是关于第三方库,或者导入文件重复的问题
文章的传送门在这里:文章链接
但是如果你的像我的一样,并没有使用第三方或者其他问题都被排除了 且还是没有解决问题的话,那么请接下去看,这里是我对刚才那篇文章的补充:
检查工程里面是否使用了全局变量,如果这个工程中有同名的全局变量时,也会报以上的错误。如:
在ViewController.m 和AACPlayer.m文件里,都用了一个名为“port”的全局变量
虽然在各自的文件里它们都能被使用,编译器编译时也能够编译,但是一旦到了链接时,就会报以上的错误
原因
这是因为:链接时,整个工程的函数和全局变量是外链接属性,即每个函数和全局变量 将来在整个工程所有的文件都能够被访问,可以粗略地理解为“合为一体”,因此报同名冲突。
解决办法:
1. 把没有到的全局变量注释掉。
如注释掉AACPlayer.m中的port。build,成功
2. 将明显不会在其他文件中引用的函数或者全局变量 用“static”关键字修饰,使之链接属性改成内链接。
如将AACPlayer.m中的port(或者ViewController.m)前面用“static”修饰,build,成功。
到此结束
阅读全文
1 0
- linker command failed with exit code 1 (use -v to see invocation)解决办法
- linker command failed with exit code 1 (use -v to see invocation)解决办法
- IOS的linker command failed with exit code 1 (use -v to see invocation)解决办法
- clang: error: linker command failed with exit code 1 (use -v to see invocation)解决办法
- clang: error: linker command failed with exit code 1 (use -v to see invocation) 解决办法
- linker command failed with exit code 1 (use -v to see invocation)解决办法
- 错误1_clang: error: linker command failed with exit code 1 (use -v to see invocation)
- Exception for IOS 1-linker command failed with exit code 1 (use -v to see invocation)
- 解决 linker command failed with exit code 1 (use -v to see invocation) 方法
- linker command failed with exit code 1 (use -v to see invocation) Undefined symbols for architecture
- error: linker command failed with exit code 1 (use -v to see invocation)
- clang: error: linker command failed with exit code 1 (use -v to see invocation)
- linker command failed with exit code 1 (use -v to see invocation)
- linker command failed with exit code 1 (use -v to see invocation)
- error: linker command failed with exit code 1 (use -v to see invocation)
- 解决 linker command failed with exit code 1 (use -v to see invocation) 的方法
- linker command failed with exit code 1 (use -v to see invocation)
- linker command failed with exit code 1 (use -v to see invocation)
- 地址与数组的小关系
- 5.1树的概念
- Unix /Linux lrzsz软件安装好后如何使用?
- 微服务开发的入门级框架Spring Boot详解(三)
- 简单实现ajax分页跳转后点击游览器自带返回按钮返回前一页
- linker command failed with exit code 1 (use -v to see invocation)解决办法
- centos7 开启PHP mysql nginx/apache 服务
- Apache服务器走过的那些坑
- 微信小程序之tab切换效果
- 关于STM32_GPIO的BSRR和BRR寄存器
- 洛谷P3368 【模板】树状数组 2
- java服务器两种方式接收数据
- Hankson的趣味题
- linux递归删除build目录