【发布时间】:2016-12-21 20:00:03
【问题描述】:
我正在测试使用 D 代码调用其他文件中的函数 我的问题是我收到我不明白的错误 在 server.d 中
import std.stdio;
extern (D) void otherFunction();
main(){
otherFunction();}
在client.d中
import std.stdio;
void otherFunction(){ writeln("hello world");}
“dmd server.d”呈现此输出错误
Undefined symbols for architecture x86_64:
"_D6server13otherFunctionFZv", referenced from:
__Dmain in server.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error: linker exited with status 1
任何想法为什么我不能拨打电话? 哦,我在 OS X 10.9 上 只要函数与 main() 在同一个文件中,调用就可以工作 /a
【问题讨论】: