c - Dlang LLVM 错误 : Program used external function which could not be resolved

标签 c llvm cross-compiling d ldc

主.d

import std.stdio;

void    main()
{
    writeln("Hello World !!!");
}

当我编译并执行它时,它工作得很好

但是当我尝试

ldc2 -output-ll main.d
lli main.ll

LLVM ERROR: Program used external function '_d_throw_exception' which could not be resolved!

我用c试试

#include<stdio.h>

void    main()
{
  printf("Hello World !!!");
}

clang -S -emit-llvm foo.c

lli foo.ll

这是工作!!

为什么在 Dlang 中编译 width ldc 时不起作用???

最佳答案

    ldc2 -output-ll -betterC main.d

    lli -load /usr/lib/libphobos2-ldc.so.72 main.ll

    ./main

输出 -> Hello World!!!

这是因为

我需要禁用所有需要运行时的功能

http://forum.dlang.org/post/pqujluaxxmtfnoofqkje@forum.dlang.org 谢谢大家和大卫·纳德林格

关于c - Dlang LLVM 错误 : Program used external function which could not be resolved,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44550353/

相关文章:

c++ - apt-get 安装后未找到 LLVM header

compilation - 简介 LLVM 通过 Clang

linux - yocto do_patch 不适用于 native

c - C auto 关键字在哪里使用?

c - PIC 中的去抖动按钮

compilation - 如何编译包含 LLVM API 头文件的 C++ 程序?

linux-kernel - 如何将dts Linux设备树源文件编译为dtb?

java - 在 Eclipse 中选择空的远程系统类型列表

c - 文件中的全局静态变量与函数中的局部静态变量具有可比性吗?

c - 在二维数组中以之字形顺序打印数字