相关疑难解决方法(0)

429
推荐指数
8
解决办法
17万
查看次数

从c ++调用Haskell

我试图从c ++调用Haskell.

我试着用这个解释; 已经问了一个关于SO的问题.

但是,我没有得到任何答案,所以我想重新制定一个最小的,完整的,可验证的例子.

我正在使用Debian,这就是我所拥有的(在同一个文件夹中):

C++:

// main.cpp
#include <iostream>
#include "Hello_stub.h"

int main(int argc, char** argv) {
  hs_init(&argc, &argv);
  std::cout << "Hello from C++\n";
  helloFromHaskell();
  hs_exit();
  return 0;
}
Run Code Online (Sandbox Code Playgroud)

哈斯克尔:

// hello.hs
module Hello where

foreign export ccall helloFromHaskell :: IO ()

helloFromHaskell :: IO ()
helloFromHaskell = putStrLn "Hello from Haskell"
Run Code Online (Sandbox Code Playgroud)

生成文件:

CPP_SOURCES = main.cpp
HASKELL_SOURCES = Hello.hs
CFLAGS = -Wall -g -fno-stack-protector
HFLAGS = -fforce-recomp

all: main; ./main

main: $(CPP_SOURCES) HaskellPart; g++ …
Run Code Online (Sandbox Code Playgroud)

c++ haskell g++ ghc

8
推荐指数
1
解决办法
490
查看次数

未定义的符号'dlsym @@ GLIBC_2.4'的引用

首先,请记住我是linux的新手.我在编译项目时遇到问题.我一直收到以下错误:

/ usr/bin/ld:CMakeFiles/Robot.dir/source/ModuleHandler.cpp.o:对符号'dlsym @@ GLIBC_2.4'的未定义引用//lib/arm-linux-gnueabihf/libdl.so.2:error添加符号:命令行collect2中缺少DSO:ld返回1退出状态

首先关闭正确的目录是:/usr/lib/arm-linux-gnueabihf/libdl.so 而不是://lib/arm-linux-gnueabihf/libdl.so

我已经尝试更新我的ldconfig.conf文件,设置LD_LIBRARY_PATH,使用ldd -r 无济于事.

CMAKE用于创建make文件.

我以前没有编译问题.它是在我进行apt-get升级或从VS尝试交叉编译之后开始的.

任何建议将不胜感激!

//弥敦道

linux ldd

6
推荐指数
1
解决办法
2万
查看次数

未定义的符号'timer_settime @@ GLIBC_2.3.3

操作系统:Linux

我试图链接mips64-softmmu/qemu-system-mips64但它导致错误:

./slirp/misc.o: In function `memset':
/usr/include/bits/string3.h:81: warning: memset used with constant zero length parameter; 
this could be due to transposed parameters
/usr/bin/ld: ../qemu-timer.o: undefined reference to symbol 'timer_settime@@GLIBC_2.3.3'
/usr/bin/ld: note: 'timer_settime@@GLIBC_2.3.3' is defined in DSO /lib64/librt.so.1 so   try adding it to the linker command line

/lib64/librt.so.1: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
make[1]: *** [qemu-system-mips64] Error 1
make: *** [subdir-mips64-softmmu] Error 2
Run Code Online (Sandbox Code Playgroud)

任何人都可以建议我如何解决这个问题.

linux qemu

4
推荐指数
2
解决办法
1万
查看次数

标签 统计

linux ×2

c++ ×1

g++ ×1

gcc ×1

ghc ×1

haskell ×1

ldd ×1

linker ×1

qemu ×1