我刚开始玩racket,想在程序中包含几个声音,所以我发现play-sound过程在racket/gui/base库中,但是当包含在2htdp/image库中时,我也会得到这个错误
*module: identifier already imported from a different source in:
make-color
racket/gui/base
2htdp/image我让play-sound只使用racket/gui就可以正常工作,但是单独使用2htdp时它是没有定义的。
>(play-sound "sounds/smash.wav" #t)
. . play-sound: undefined;发布于 2014-11-20 04:59:54
您可以使用only-in只要求模块中的特定函数。例如,这个计算结果没有错误:
#lang racket
(require 2htdp/image
(only-in racket/gui/base play-sound))
(define (f)
(play-sound "/path/to/file" #t))https://stackoverflow.com/questions/27031461
复制相似问题