[Issue 20667] fatal error LNK1179 on windows-x86_64-dmd with MSVC

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Apr 29 06:38:04 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=20667

kntroh at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kntroh at gmail.com

--- Comment #1 from kntroh at gmail.com ---
I got a similar error. However, the error code was LNK2005:

source/test.d:
---
import b;
void main() { }
---

sub/a.d:
---
import std.algorithm;
---

sub/b.d:
---
module b;
import std;
class C { void c() { f(); } }
struct S {
  double a = 0;
  string b;
  S[] c;
  @disable
  this ();
}
S f() {
  int[] arr;
  array(map!(a => f())(arr));
  assert (0);
}
---

dub.json:
---
{
  "name": "test",
  "targetType": "executable",
  "application": "test.d",
  "dependencies": { ":sub": "*" },
  "subPackages": [{
    "name": "sub",
    "targetType": "library",
    "sourcePaths": [ "sub" ],
    "importPaths": [ "sub" ]
  }]
}
---

When I prepare these files and build it by dub on Windows, I got an error that
"__bzeroBytes already defined".
I have confirmed the reproduction with dmd 2.096.1 on Windows 8.1 and Windows
10 (20H2).

$ dub
Performing "debug" build using ***\dmd2\windows\bin\dmd.exe for x86_64.
test:sub ~master: target for configuration "library" is up to date.
test ~master: building configuration "application"...
Linking...
test_sub.lib(b_33_53.obj) : error LNK2005: __bzeroBytes は既に
test_sub.lib(b_40_9af.obj) で定義されています。(__bzeroBytes already defined in
test_sub.lib(h_48_8a7.obj))
.dub\build\application-debug-windows-x86_64-dmd_v2.096.1-dirty-4872E8CFA9A99F10C9963544DB0FC94E\test.exe
: fatal error LNK1169: 1 つ以上の複数回定義されているシンボルが見つかりました。(found one or more symbols
with multiple definitions)
Error: linker exited with status 1169
***\dmd2\windows\bin\dmd.exe failed with exit code 1.
$

I tried to see if I could make the reproduction code smaller, but it was
impossible. For example, just replace `double a = 0;` with `double a = 1;` and
it will not reproduce.

--


More information about the Digitalmars-d-bugs mailing list