今天把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*)"的更多相关文章

  1. oc调用c++接口时 报错 Undefined symbols for architecture i386:

    当在oc中调用c++中的方法时,发现说c++中的方法没定义或是找不到 Undefined symbols for architecture i386: "_desTYData", ...

  2. 当编译AFNetworking 2.0时出现了Undefined symbols for architecture i386

    当将AFNetworking添加到工程后编译时出现 Undefined symbols for architecture i386: "_SecCertificateCopyData&quo ...

  3. Undefined symbols for architecture i386: "_deflate", referenced from:

    Undefined symbols for architecture i386: "_deflate", referenced from: PlatCompress(enumCom ...

  4. Undefined symbols for architecture i386:和"_OBJC_CLASS_$_xx", referenced from:问题解决方法

    多个人共同操作同一个项目或拷贝项目时,经常会出现类似这样的问题: Undefined symbols for architecture i386: "_OBJC_CLASS_$_xx文件名& ...

  5. Undefined symbols for architecture i386:"_OBJC_CLASS_$_xx", referenced from: 解决方法

    多个人共同操作同一个项目或拷贝项目时,经常会出现类似这样的问题: Undefined symbols for architecture i386: "_OBJC_CLASS_$_xx文件名& ...

  6. 【转】Undefined symbols for architecture i386:和"_OBJC_CLASS_$_xx", referenced from:问题解决方法

    多个人共同操作同一个项目或拷贝项目时,经常会出现类似这样的问题: Undefined symbols for architecture i386: "_OBJC_CLASS_$_xx文件名& ...

  7. iOS:编译错误Undefined symbols for architecture i386: _OBJC_CLASS_$_XXX", referenced from: error

    Undefined symbols for architecture i386: _OBJC_CLASS_$_XXX", referenced from: error 这个意思为无法找到名为 ...

  8. Undefined symbols for architecture i386

    这个错误的发生原因一般是“XXX”这个文件(类库)虽然引入了工程中,但是由于种种原因(常见于多人开发,svn同步不规范)导致“XXX”并未被添加到project.pbxproj这个文件中. 解决方法是 ...

  9. 微信SDK导入报错 Undefined symbols for architecture i386:"operator delete[](void*)", referenced from:

    异常信息: Undefined symbols for architecture i386:  "operator delete[](void*)", referenced fro ...

随机推荐

  1. Interview----用最快的方法计算 Fibonacci 数

    输入 n, 用最快的方法求该 Fibocacci 数列的第 n 项. 方法1: 递归,非常慢 方法2: 迭代,因此计算 f[1] , f[2], f[3] ,,,, 复杂度 O(N) 方法3: 采用以 ...

  2. BZOJ 4131 并行博弈

    发现必胜态只和(1,1)的状态有关. 无法得知必胜的方法,只知道谁会必胜. #include<iostream> #include<cstdio> #include<cs ...

  3. BZOJ 1690 奶牛的旅行

    分数规划. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm& ...

  4. C++之创建对象时的new与不new

    C++在创建对象的时候可以采用两种方式:(例如类名为Test) Test test  或者 Test* pTest = new Test(). 这两种方法都可以实例化一个对象,但是这两种方法有很大的区 ...

  5. iOS:开发者中心证书创建流程

    一,首先点击开发者首页(https://developer.apple.com/)里面的Member Center.二,输入开发者账号和密码,点击sign in登录.三,点击Certificates, ...

  6. 7、SQL基础整理(子查询)

    子查询 (用来进行两个或以上表之间的查询) 1.首先新建一个bumen表和一个haha表,填充数据 2.利用两表进行子查询: --部门人数大于5的部门中最大年龄的人的信息--- select MAX( ...

  7. 批处理中for循环多个%

    实例:@echo offset NUM=10000for /f %%i in (字符.txt) do (set JSZF=%%ifor /L %%. in (0,1,%NUM%) do ( Call ...

  8. DirectX游戏编程入门

    刚开始学习D3D,安装完DirectX9后,在VS2008中新建Win32项目· ----------------------------------------------------------- ...

  9. Rest中获取制定操作的UriTemplate

    UriTemplate uri = WebOperationContext.Current.GetUriTemplate("DownloadFile");

  10. mysql [ERROR] Can't create IP socket: Permission denied

    /*************************************************************************** * mysql [ERROR] Can't c ...