C ld:找不到符号。。。(新闻频道)

C ld:找不到符号。。。(新闻频道),c,macos,macos-carbon,C,Macos,Macos Carbon,我不明白为什么会发生这种情况: "_NewSpeechChannel", referenced from: _main in ccOIJZkQ.o ld: symbol(s) not found collect2: ld returned 1 exit status 简单的代码是: #include<stdio.h> #include<ApplicationServices/ApplicationServices.h> int main(int argc, char

我不明白为什么会发生这种情况:

"_NewSpeechChannel", referenced from:
_main in ccOIJZkQ.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
简单的代码是:

#include<stdio.h>
#include<ApplicationServices/ApplicationServices.h>

int main(int argc, char **argv, char **envp, char **apple) {

  SpeechChannel speechchannel;
  NewSpeechChannel( NULL, &speechchannel );

}
#包括
#包括
int main(int argc、char**argv、char**envp、char**apple){
演讲频道;
NewSpeechChannel(NULL和speechchannel);
}
汇编步骤:

使用内置规格

目标:i686-apple-darwin10 配置为//VAR/TMP/GCC-G56-663.3/SRC/Obj-禁用检查-启用WError -前缀=/USR——下颌骨= /Stuts/MAN-启用语言= C、Objc、C++、Obj-C++程序转换名=/^ [CG] [^·-]*$/s/$/-4.2/--带slibdir=/usr/lib--build=i686-apple-darwin10--program prefix=i686-apple-darwin10--host=x86_64-apple-darwin10--target=i686-apple-darwin10--带gxx include dir=/include/c++/4.2.1

线程模型:posix

gcc版本4.2.1(Apple Inc.build 5666)(dot 3)

/usr/libexec/gcc/i686-apple-darwin10/4.2.1/cc1-quiet-v-imultilib x86_64-D_DYNAMIC_uufirst.c-fPIC-quiet-dumpbase first.c-mmacosx version min=10.6.8-m64-mtune=core2-auxbase first-version-o/var/folders/HQ/hqeebrxzfdotlnwf1cxdu++/-Tmp-//ccyQukF0.s

忽略不存在的目录“/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../../../../i686-apple-darwin10/include”

#包括“…”搜索从这里开始:

#包括搜索从这里开始:

/usr/本地/包括

/usr/lib/gcc/i686-apple-darwin10/4.2.1/include

/usr/包括

/系统/库/框架(框架目录)

/库/框架(框架目录)

搜索列表结束

GNU C版本4.2.1(苹果公司生产5666)(dot 3)(i686-Apple-darwin10)

由GNUC4.2.1版(苹果公司5666版)(dot 3)编译

GGC启发式:--param GGC min expand=150--param GGC min heapsize=131072

编译器可执行校验和:fdbb4a71861779b5591b0cf47736cbe7

/usr/libexec/gcc/i686-apple-darwin10/4.2.1/as-arch x86_64-force_cpusubtype_ALL-o/var/folders/HQ/hqeebrxzfdotlnwf1cxdu++TI/-Tmp-//ccRRVBTR.o/var/folders/HQ/hqeebrxzfdotlnwf1cxdu++TI/-Tmp-//ccyQukF0.s

/usr/libexec/gcc/i686-apple-darwin10/4.2.1/collect2-dynamic-arch x86_64-macosx_version_min 10.6.8-weak_reference_失配非弱-o a.out-lcrt1.10.6.o-L/usr/lib/i686-apple-darwin10/4.2.1/x86_64-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/x86-apple-darwin10/4.1/gcc-L/usr/lib/gcc/i686-apple-darwin10/4.2.1-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../../i686-apple-darwin10/4.2.1-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../..//var/folders/HQ/HQEeBRxZFdOTLnWFF1cxDU+++TI/-Tmp-//ccRRVBTR.o-lSystem-lgcc-lSystem

未定义的符号:

“_NewSpeechChannel”,引用自:

_ccRRVBTR.o中的主管道

ld:找不到符号

collect2:ld返回了1个退出状态


我通过使用gcc-v得到的,你没有链接你需要链接的库。显示链接步骤。具有函数
NewSpeechChannel
实现的库(或目标文件)不在
路径中。通过向编译行添加
-v
标志来显示编译步骤。我添加了编译步骤。