- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
链接以下两个文件会给我一个链接错误:
广告:
import std.stdio;
extern string test ();
void main() {
writeln(test());
readln();
}
string test () {
return "hello";
}
Error 42: Symbol Undefined _D1a4testFZAya`
---errorlevel 1
import std.stdio;
import b;
void main() {
writeln("some_var from Module b: \"", b.some_var, "\"");
}
public string some_var = "Hello, world!";
//you can also use static module constructors to set your vars
static this() {
some_var ~= " -- How are you?";
}
最佳答案
修改您的 a.d
到:
import std.stdio;
import b;
//extern string test ();
void main() {
writeln(test());
readln();
}
extern
是一个链接属性,主要用于指定给定函数(通常是某个库中的 C 函数)使用的调用约定。更多关于
extern
和其他属性在这里:
http://www.d-programming-language.org/attribute.html .如果您拥有的只是 D 源文件,则真的不需要 extern。但是,如果您混合使用 C 或 C++ 和 D 代码,您肯定会使用它。
关于dmd 链接器 (OPTLINK) 给出错误 42 : Symbol Undefined when using extern,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8631476/
我编译文件 stacktrace.d:void main(){assert(false);} 关闭 ASLR,运行时我得到: core.exception.AssertError@stacktrace
我正在尝试在 Windows 中使用 DMD 编译器本身(没有 IDE)构建一个项目。而且我发现自己几乎无法意识到有关链接的某些时刻。通常 IDE 会为我做这件事。 我的项目结构 project ├─
我目前正在试用DerelictSDL2 (绑定(bind)到 D 的 SDL2 库)并且我编写了一个成功加载 JPG 图像并将其显示在窗口中的代码。也就是说,当它使用 dmd 编译时。当我尝试使用 g
我可以测试 DMD 是否正在使用 version(DMD){} 编译给定的代码,但我如何检查它的哪个版本? (2.66/2.65 等) 更简洁地说,我想检查 @nogc修饰符存在, 如果不是 - 定义
根据 http://dlang.org/statement.html 的“Foreach 限制”部分以下代码 int[] a; int[] b; foreach (int i; a) { a
有时 SciTE(以及程序员记事本)会停止处理 DMD.exe 输出的错误消息。 我发现,他们都无法跳转到 game.d 中的第 81 行:“game.d(81):一些错误” 而这个有效:“game.
这里我想锁步迭代两个 size_t 数组 import std.stdio; import std.range; import std.exception; import std.conv; stru
人们一直试图用旧版本的 Dmd 和 Dub(0.9.2 而不是 1.0.0)来构建我的项目,但它不起作用。我可以在 dub.json 文件中指定所需的最小配音版本吗? 最佳答案 不幸的是你不能。见 t
我有一个名为“dprogram.d”的 d 源文件,并在 mac osx 的终端中使用命令 $ dmd dprogram.d 创建一个可执行文件。根据官方文档,编译器将自动编译源代码并链接 .o 目标
根据 http://dlang.org/statement.html 的“Foreach 限制”部分以下代码 int[] a; int[] b; foreach (int i; a) { a
我是 D 编程新手。选择 DMD (2.061) 或 GDC(4.6、4.7 或 4.8,快照)的优缺点是什么?我应该选择哪个 GDC 版本?我已经成功构建了 GCC-4.8 和 GDC-4.8 的最
我在 D 中有一个模板类,它以另一个模板作为参数,它是这样开始的: class RuleVars(alias RuleType, RuleRange, SubstitutionRange) if (_
我有一个名为“dprogram.d”的 d 源文件,并在 mac osx 的终端中使用命令 $ dmd dprogram.d 创建一个可执行文件。根据官方文档,编译器将自动编译源代码并链接 .o 目标
每当我使用 DMD 构建静态库时,我都能够将它链接到我的应用程序并且编译正常,但是在应用程序中调用库的任何时候我都会得到: Segmentation fault (core dumped) 为了构建我
我正在尝试安装 DMD,因此完全遵循此页面上提供的建议:http://dlang.org/dmd-osx.html .但是,当我尝试构建 .d 文件时出现错误: 这是我的hello.d import
我有 Solaris 10 + Zenoss 2.7.0,如果没有 Oracle 许可证,我无法升级它,因此我尝试寻找解决方法,这就是我请求您帮助的原因。 对于过去 5 分钟内收到的来自同一设备的任何
我只是从 http://www.digitalmars.com/d/download.html 安装了 DMD 编译器对于 Ubuntu 64 位 (dmd_2.055-0_amd64.deb)。但是
有人在 Snow Leopard 上试过 Digitalmars D 编译器(第 2 版)吗?我想升级,但我宁愿有一个可用的 D 编译器。 最佳答案 如果您仍然不确定,请深呼吸并开始尝试: Chang
我想部分等效的问题:使用 DMD 编译的代码是否应该在所有情况下使用 GDC 自动编译? 我问是因为我在从 ubuntu 10.4(看似循环依赖,叹气)存储库安装现代版本的 GDC 时遇到问题。 最佳
当我import etc.c.curl; DMD 告诉我 Warning 2: File Not Found curl.lib 这个 curl.lib 在哪里? (我尝试了 http://curl.h
我是一名优秀的程序员,十分优秀!