Undefined symbols for architecture i386: "MyGetOpenALAudioData(__CFURL const*, int*, int*, int*)"
今天把apple developer上的例子程序oalTouch中的MyOpenALSupport.h和MyOpenALSupport.c添加到自己的工程中,并在另一个文件xxx.cpp里调用,结果出现报错:
Undefined symbols for architecture i386:
"MyGetOpenALAudioData(__CFURL const*, int*, int*, int*)", referenced from:
Cc3dALBuffer::initBuffer(std::string const&, void*&, unsigned int&) in c3dALBuffer.o
"alBufferDataStaticProc(int, int, void*, int, int)", referenced from:
Cc3dALBuffer::initBuffer(std::string const&, void*&, unsigned int&) in c3dALBuffer.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
起初不解。后搜索到下帖:
http://www.idevgames.com/forums/printthread.php?tid=8148
才明白,原来c++调用.c文件中的函数是需要使用extern "C"的。
于是在xxx.h中加入以下代码:
extern"C" {
#include"MyOpenALSupport.h"
};
问题就解决了。
----补充:
在自己的项目中使用oalTouch中的MyOpenALSupport.h和MyOpenALSupport.c,结果发现某些音效会带有兹兹的杂音。但改用MusicCube例子程中的MyOpenALSupport.h就不会出现问题,对比了一下,发现oalTouch和MusicCube两个例子中的MyGetOpenALAudioData函数的实现却实有差别,那么只能认为oalTouch中MyGetOpenALAudioData的实现有bug了。
注,改用MusicCube中的MyOpenALSupport.h。起初编译不过,MyGetOpenALAudioData中的goto Exit语句报"goto into protected scope"的错误。于是把MusicCube中的MyOpenALSupport.h也拆成MyOpenALSupport.h和MyOpenALSupport.c两个文件,然后就可以编译通过了。
Undefined symbols for architecture i386: "MyGetOpenALAudioData(__CFURL const*, int*, int*, int*)"的更多相关文章
- oc调用c++接口时 报错 Undefined symbols for architecture i386:
当在oc中调用c++中的方法时,发现说c++中的方法没定义或是找不到 Undefined symbols for architecture i386: "_desTYData", ...
- 当编译AFNetworking 2.0时出现了Undefined symbols for architecture i386
当将AFNetworking添加到工程后编译时出现 Undefined symbols for architecture i386: "_SecCertificateCopyData&quo ...
- Undefined symbols for architecture i386: "_deflate", referenced from:
Undefined symbols for architecture i386: "_deflate", referenced from: PlatCompress(enumCom ...
- Undefined symbols for architecture i386:和"_OBJC_CLASS_$_xx", referenced from:问题解决方法
多个人共同操作同一个项目或拷贝项目时,经常会出现类似这样的问题: Undefined symbols for architecture i386: "_OBJC_CLASS_$_xx文件名& ...
- Undefined symbols for architecture i386:"_OBJC_CLASS_$_xx", referenced from: 解决方法
多个人共同操作同一个项目或拷贝项目时,经常会出现类似这样的问题: Undefined symbols for architecture i386: "_OBJC_CLASS_$_xx文件名& ...
- 【转】Undefined symbols for architecture i386:和"_OBJC_CLASS_$_xx", referenced from:问题解决方法
多个人共同操作同一个项目或拷贝项目时,经常会出现类似这样的问题: Undefined symbols for architecture i386: "_OBJC_CLASS_$_xx文件名& ...
- iOS:编译错误Undefined symbols for architecture i386: _OBJC_CLASS_$_XXX", referenced from: error
Undefined symbols for architecture i386: _OBJC_CLASS_$_XXX", referenced from: error 这个意思为无法找到名为 ...
- Undefined symbols for architecture i386
这个错误的发生原因一般是“XXX”这个文件(类库)虽然引入了工程中,但是由于种种原因(常见于多人开发,svn同步不规范)导致“XXX”并未被添加到project.pbxproj这个文件中. 解决方法是 ...
- 微信SDK导入报错 Undefined symbols for architecture i386:"operator delete[](void*)", referenced from:
异常信息: Undefined symbols for architecture i386: "operator delete[](void*)", referenced fro ...
随机推荐
- Python入门(一,Ubuntu环境搭建)
一,Python下载 下载地址:http://www.python.org/download/ 二,安装 在Ubuntu平台上安装Python步骤: 1.解压缩下载的源码压缩包 2.在解压缩的目录下执 ...
- HTML的定位属性
position 用于定义一个元素是否absolute(绝对),relative(相对),static(静态),或者fixed(固定) top层距离顶点纵坐标的距离 left层距离顶点横坐标的距 ...
- Error Handling and Exception
The default error handling in PHP is very simple.An error message with filename, line number and a m ...
- HTTP消息头
(一)初识HTTP消息头 但凡搞WEB开发的人都离不开HTTP(超文本传输协议),而要了解HTTP,除了HTML本身以外,还有一部分不可忽视的就是HTTP消息头.做过Socket编程的人都知道,当我们 ...
- HDU 4888 (网络流)
Poroblem Redraw Beautiful Drawings (HDU4888) 题目大意 一个n行m列的矩形,只能填0~k的数字. 给定各行各列的数字和,判定有无合法的方案数.一解给出方案, ...
- 解决input之间的空隙
<!doctype html> <html> <head> <meta charset="UTF-8"> <meta name ...
- Magento 自定义URL 地址重写 分类分级显示
我们打算将URL在分类页面和产品页面分别定义为: domain.com/category/分类名.html domain.com/category/子分类名.html domain.com/goods ...
- gitlab The repository for this project is empty
/***************************************************************************** * gitlab The reposito ...
- 【Sublime Text 3】插件
TrailingSpacer 高亮显示多余的空格和Tab HTML-CSS-JS Prettify
- 机器学习技法-决策树和CART分类回归树构建算法
课程地址:https://class.coursera.org/ntumltwo-002/lecture 重要!重要!重要~ 一.决策树(Decision Tree).口袋(Bagging),自适应增 ...