小编Mik*_*ike的帖子

ubuntu haskell ghci 7.4.1找不到模块"System.Random"

当我试图在ghci中加载.hs时,它就失败了:

import System.Random
Run Code Online (Sandbox Code Playgroud)

信息:

Could not find module `System.Random'
Use -v to see a list of the files searched for.
Run Code Online (Sandbox Code Playgroud)

我记得它昨天工作,今天突然间它不起作用.这个问题只发生在Ubuntu 12.04 LTS,GHCi 7.4.1上,当我在Windows haskell平台和我工作的其他linux机器上试过这个.

我试着用

 sudo apt-get remove ghc
 sudo apt-get install ghc
Run Code Online (Sandbox Code Playgroud)

删除并重新安装ghc,但问题仍然存在.

有人能帮助我吗?谢谢

haskell

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

使用-lpthread,g ++编译器错误,"未定义引用"信号量调用,例如`sem_open'

我是posix线程库的新手,我尝试从教程中编译示例代码:

g++ -lpthread agreement.cpp -o agreement
Run Code Online (Sandbox Code Playgroud)

但是我无法编译代码并收到以下错误消息:

a3q2.cpp:(.text+0x7e): undefined reference to `sem_open'
a3q2.cpp:(.text+0xab): undefined reference to `sem_wait'
a3q2.cpp:(.text+0x290): undefined reference to `sem_post'
a3q2.cpp:(.text+0x2af): undefined reference to `sem_close'
a3q2.cpp:(.text+0x2bb): undefined reference to `sem_unlink'
collect2: ld returned 1 exit status
make: *** [a3q2_exe] Error 1
Run Code Online (Sandbox Code Playgroud)

我知道编译工作需要-lpthread,但是我可能还需要其他任何选项才能解决问题吗?如果不是我如何安装"正确的"pthread库?

谢谢你的帮助!

c++ linux multithreading system-calls undefined-reference

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