0

大约 20 分钟前,我尝试编译我的一个项目,它编译并链接到一个可执行文件中。我添加了三个D源文件,编辑了一些代码,并尝试重新编译。它失败了。这本身并没有什么特别之处。但是,构建输出是:

dub build "accord" "--build=plain"
Building package accord in F:\Development\accord\
Target derelict-util 2.0.0 is up to date. Use --force to rebuild.
Target derelict-glfw3 1.1.0 is up to date. Use --force to rebuild.
Target derelict-gl3 1.0.13 is up to date. Use --force to rebuild.
Building accord ~master configuration "application", build type plain.
Compiling using dmd...
Linking...
Error: cannot read file C:\Users\Spirit.d
FAIL .dub/build/application-plain-windows-x86-dmd_2067-7C65CD25249AF071E7C1F1FC64628B8A
Error executing command build:
dmd failed with exit code 1.
Exit code 2
Build complete -- 1 error, 0 warnings

我正在使用 Mono-D。我尝试的任何其他项目似乎都能完美编译。我不知道为什么 Dub 在我的用户目录中查找源文件。我的 JSON 文件是 Dub 生成的标准票价,其中 Derelict-Util (v2.0.0)、Derelict-GL3 (v1.0.13) 和 Derelict-GLFW3 (v1.1.0) 作为依赖项。我花了一些时间在互联网上寻找解决方案,但可能错过了一些东西。如果我这样做了,请指出我正确的方向。谢谢!

[编辑] 详细编译器输出

F:\Development\accord>dub --vverbose -c -gc -w -gs -vcolumns
Error processing arguments: Can't parse string: bool should be
case-insensitive 'true' or 'false'
Run 'dub help' for usage information.

F:\Development\accord>dub --verbose -debug
Using dub registry url 'http://code.dlang.org/'
Refreshing local packages (refresh existing: true)...
Looking for local package map at C:\ProgramData\dub\packages\local-   packages.json
Looking for local package map at C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\local-packages.json
Note: Failed to determine version of package accord at .. Assuming ~master.
Refreshing local packages (refresh existing: false)...
Looking for local package map at C:\ProgramData\dub\packages\local-packages.json
Looking for local package map at C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\local-packages.json
Found dependency derelict-util 2.0.0
Found dependency derelict-glfw3 1.1.0
Found dependency derelict-gl3 1.0.13
Checking for missing dependencies.
Using fixed selection derelict-util 2.0.0
Using fixed selection derelict-glfw3 1.1.0
Using fixed selection derelict-gl3 1.0.13
Refreshing local packages (refresh existing: false)...
Looking for local package map at C:\ProgramData\dub\packages\local-packages.json
Looking for local package map at C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\local-packages.json
Found dependency derelict-util 2.0.0
Found dependency derelict-glfw3 1.1.0
Found dependency derelict-gl3 1.0.13
Checking for upgrades.
Using cached upgrade results...
Generating using build
Generate target accord (executable F:\Development\accord accord)
Generate target derelict-util (staticLibrary C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-util-2.0.0\lib DerelictUtil)
Generate target derelict-glfw3 (staticLibrary C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-glfw3-1.1.0\lib DerelictGLFW3)
Generate target derelict-gl3 (staticLibrary C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.13\lib DerelictGL3)
Target 'C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-util-2.0.0\.dub\build\library-debug-windows-x86-dmd_2067-C7756503D110D460F4F4728E71250CDA\DerelictUtil.lib' doesn't exist, need rebuild.
Building derelict-util 2.0.0 configuration "library", build type debug.
Running dmd...
dmd -lib -ofC:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-util-2.0.0\.dub\build\library-debug-windows-x8
6-dmd_2067-C7756503D110D460F4F4728E71250CDA\DerelictUtil.lib -debug -g -w -version=Have_derelict_util -debug=ebug -IC:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-util-2.0.0\source C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-util-2.0.0\source\derelict\util\exception.d C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-util-2.0.0\source\derelict\util\loader.d C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-util-2.0.0\source\derelict\util\sharedlib.d C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-util-2.0.0\source\derelict\util\system.d C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-util-2.0.0\source\derelict\util\wintypes.d C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-util-2.0.0\source\derelict\util\xtypes.d
Copying target from C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-util-2.0.0\.dub\build\library-debug-windows-x86-dmd_2067-C7756503D110D460F4F4728E71250CDA\DerelictUtil.lib to C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-util-2.0.0\lib
Target 'C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-glfw3-1.1.0\.dub\build\library-debug-windows-x86-dmd_2067-256C068A151384E40C20A4D884247016\DerelictGLFW3.lib' doesn't exist, need rebuild.
Building derelict-glfw3 1.1.0 configuration "library", build type debug.
Running dmd...
dmd -lib -ofC:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-glfw3-1.1.0\.dub\build\library-debug-windows-x86-dmd_2067-256C068A151384E40C20A4D884247016\DerelictGLFW3.lib -debug -g -w -version=Have_derelict_glfw3 -version=Have_derelict_util -debug=ebug -IC:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-glfw3-1.1.0\source -IC:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-util-2.0.0\source C:\Users\Spirit of Fire\AppData\Roaming\dub\packag
es\derelict-glfw3-1.1.0\source\derelict\glfw3\glfw3.d
Copying target from C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-glfw3-1.1.0\.dub\build\library-debug-windows-x86-dmd_2067-256C068A151384E40C20A4D884247016\DerelictGLFW3.lib to C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-glfw3-1.1.0\lib
Target 'C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.13\.dub\build\library-debug-windows-x86-dm
d_2067-80F0E608548819662CF8E3FD924A262A\DerelictGL3.lib' doesn't exist, need rebuild.
Building derelict-gl3 1.0.13 configuration "library", build type debug.
Running dmd...
dmd -lib -ofC:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.13\.dub\build\library-debug-windows-x8
6-dmd_2067-80F0E608548819662CF8E3FD924A262A\DerelictGL3.lib -debug -g -w -version=Have_derelict_gl3 -version=Have_dereli
ct_util -debug=ebug -IC:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.13\source -IC:\Users\Spirit
of Fire\AppData\Roaming\dub\packages\derelict-util-2.0.0\source C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\der
elict-gl3-1.0.13\source\derelict\opengl3\arb.d C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.13\
source\derelict\opengl3\cgl.d C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.13\source\derelict\o
pengl3\constants.d C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.13\source\derelict\opengl3\depr
ecatedConstants.d C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.13\source\derelict\opengl3\depre
catedFunctions.d C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.13\source\derelict\opengl3\ext.d
C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.13\source\derelict\opengl3\functions.d C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.13\source\derelict\opengl3\gl.d C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.13\source\derelict\opengl3\gl3.d C:\Users\Spirit of Fire\AppData\Roaming\dub\pa
ckages\derelict-gl3-1.0.13\source\derelict\opengl3\glx.d C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.13\source\derelict\opengl3\glxext.d C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.13\source\derelict\opengl3\internal.d C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.13\source\derelict\opengl3\types.d C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.13\source\derelict\opengl3\wgl.d C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.13\source\derelict\opengl3\wglext.d
Copying target from C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.13\.dub\build\library-debug-wi
ndows-x86-dmd_2067-80F0E608548819662CF8E3FD924A262A\DerelictGL3.lib to C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.13\lib
Target 'F:\Development\accord\.dub\build\application-debug-windows-x86-dmd_2067-9CBD45F8F21245983EC54AD7179D55CE\accord.exe' doesn't exist, need rebuild.
Building accord ~master configuration "application", build type debug.
Compiling using dmd...
dmd -c -of.dub\build\application-debug-windows-x86-dmd_2067-9CBD45F8F21245983EC54AD7179D55CE\accord.obj -debug -g -w -version=Have_accord -version=Have_derelict_util version=Have_derelict_glfw3 -version=Have_derelict_gl3 -debug=ebug -Isource -IC:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-util-2.0.0\source -IC:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-glfw3-1.1.0\source -IC:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.
13\source source\accord\core\opengl\ContextConfigs.d source\accord\core\opengl\FramebufferConfigs.d source\accord\core\system\Window.d source\accord\util\Closable.d source\accord\util\collections\Stack.d source\accord\util\glutil.d source\accord\util\io\FileData.d source\accord\util\io\FileInputStream.d source\accord\util\io\InputStream.d source\accord\util\stringutil.d source\app.d
Linking...
dmd -of.dub\build\application-debug-windows-x86-dmd_2067-9CBD45F8F21245983EC54AD7179D55CE\accord.exe .dub\build\applicat
ion-debug-windows-x86-dmd_2067-9CBD45F8F21245983EC54AD7179D55CE\accord.obj C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-glfw3-1.1.0\lib\DerelictGLFW3.lib C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.13\lib\DerelictGL3.lib C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-util-2.0.0\lib\DerelictUtil.lib -g

Error: cannot read file C:\Users\Spirit.d
FAIL .dub\build\application-debug-windows-
x86-dmd_2067-9CBD45F8F21245983EC54AD7179D55CE\ accord executable
Error executing command run:
dmd failed with exit code 1.

[编辑]:我已经确定了问题。链接器似乎认为我正在构建一个库,而不是一个应用程序。我不知道我做了什么,但我不知道如何解决它。所以,我现在的问题是:如何改回来?谢谢。

[编辑]:没关系。将构建类型更改为什么executable也不做。

[编辑]:我尝试使用配音 v0.9.22(来自 v0.9.23),它似乎链接正常。我不知道是怎么回事。

4

1 回答 1

0

我怀疑您添加的源文件带来了一些隐藏的依赖项 - 去看看一些导入的“Spirit”模块,这应该清楚为什么 dmd(不是配音(!) - 它是 dmd 无法查找所述导入)不能找到文件。

C:\Users路径似乎是 dmd 查找导入文件的最后手段。

[编辑] 它没有链接整个东西,而它应该无法编译所有东西——这也可能是一个提示。

于 2015-06-12T12:58:59.153 回答