Thread overview
[Issue 20667] fatal error LNK1179 on windows-x86_64-dmd with MSVC
Apr 29, 2021
kntroh@gmail.com
Dec 17, 2022
Iain Buclaw
April 29, 2021
https://issues.dlang.org/show_bug.cgi?id=20667

kntroh@gmail.com changed:

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

--- Comment #1 from kntroh@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.

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=20667

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3

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

--- Comment #2 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/19675

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--