Skip to content

Missing Reflect on a child leads to linker errors on Windows #14607

Closed as not planned
@kleinesfilmroellchen

Description

@kleinesfilmroellchen

Bevy version

0.14

What you did

I used #[derive(Reflect)] on several components that were missing a Reflect implementation on a child type. While this is of course not possible, I would expect a nicer error message than some linker errors that had me searching for about half an hour.

What went wrong

The build fails with linker errors like this one:

error: linking with `link.exe` failed: exit code: 1120
<long and sensitive linker invocation line omitted>

  = note: lib.def : error LNK2001: Nicht aufgelöstes externes Symbol "_ZN3cmp5model3nav1_108_$LT$impl$u20$bevy_reflect..type_registry..GetTypeRegistration$u20$for$u20$cmp..model..nav..NavComponent$GT$21get_type_registration17haeef134c9a08e10bE".␍
          lib.def : error LNK2001: Nicht aufgelöstes externes Symbol "_ZN3cmp5model3nav1_108_$LT$impl$u20$bevy_reflect..type_registry..GetTypeRegistration$u20$for$u20$cmp..model..nav..NavComponent$GT$26register_type_dependencies17hd5b05f4b2184b1feE".␍
          lib.def : error LNK2001: Nicht aufgelöstes externes Symbol "_ZN3cmp5model3nav1_90_$LT$impl$u20$bevy_reflect..reflect..Reflect$u20$for$u20$cmp..model..nav..NavComponent$GT$18reflect_partial_eq17h7193ed9efffbe4edE".␍
          lib.def : error LNK2001: Nicht aufgelöstes externes Symbol "_ZN3cmp5model3nav1_90_$LT$impl$u20$bevy_reflect..type_info..Typed$u20$for$u20$cmp..model..nav..NavComponent$GT$9type_info17h1383952cb944e417E".␍
          lib.def : error LNK2001: Nicht aufgelöstes externes Symbol "_ZN3cmp5model3nav1_94_$LT$impl$u20$bevy_reflect..struct_trait..Struct$u20$for$u20$cmp..model..nav..NavComponent$GT$11iter_fields17h374bad68a829126dE".␍
          lib.def : error LNK2001: Nicht aufgelöstes externes Symbol "_ZN3cmp5model3nav1_94_$LT$impl$u20$bevy_reflect..struct_trait..Struct$u20$for$u20$cmp..model..nav..NavComponent$GT$12field_at_mut17ha33376bd44e99291E".␍
          lib.def : error LNK2001: Nicht aufgelöstes externes Symbol "_ZN3cmp5model3nav1_94_$LT$impl$u20$bevy_reflect..struct_trait..Struct$u20$for$u20$cmp..model..nav..NavComponent$GT$13clone_dynamic17h76e402f00bd92585E".␍
          lib.def : error LNK2001: Nicht aufgelöstes externes Symbol "_ZN3cmp5model3nav1_94_$LT$impl$u20$bevy_reflect..struct_trait..Struct$u20$for$u20$cmp..model..nav..NavComponent$GT$5field17hcd641fb8c9a404e5E".␍
          lib.def : error LNK2001: Nicht aufgelöstes externes Symbol "_ZN3cmp5model3nav1_94_$LT$impl$u20$bevy_reflect..struct_trait..Struct$u20$for$u20$cmp..model..nav..NavComponent$GT$7name_at17h885325772a3bb243E".␍
          lib.def : error LNK2001: Nicht aufgelöstes externes Symbol "_ZN3cmp5model3nav1_94_$LT$impl$u20$bevy_reflect..struct_trait..Struct$u20$for$u20$cmp..model..nav..NavComponent$GT$8field_at17h8b4d6a71a905aafaE".␍
          lib.def : error LNK2001: Nicht aufgelöstes externes Symbol "_ZN3cmp5model3nav1_94_$LT$impl$u20$bevy_reflect..struct_trait..Struct$u20$for$u20$cmp..model..nav..NavComponent$GT$9field_len17hac564c17a54c82edE".␍
          lib.def : error LNK2001: Nicht aufgelöstes externes Symbol "_ZN3cmp5model3nav1_94_$LT$impl$u20$bevy_reflect..struct_trait..Struct$u20$for$u20$cmp..model..nav..NavComponent$GT$9field_mut17h014f952078d75a88E".␍
          lib.def : error LNK2001: Nicht aufgelöstes externes Symbol "_ZN3cmp5model3nav1_99_$LT$impl$u20$bevy_reflect..from_reflect..FromReflect$u20$for$u20$cmp..model..nav..NavComponent$GT$12from_reflect17h0317fca958b30622E".␍
          lib.def : error LNK2001: Nicht aufgelöstes externes Symbol "_ZN3cmp8graphics1_81_$LT$impl$u20$bevy_reflect..reflect..Reflect$u20$for$u20$cmp..graphics..Sides$GT$18reflect_partial_eq17h895ddd3c776b4042E".␍
          lib.def : error LNK2001: Nicht aufgelöstes externes Symbol "_ZN3cmp8graphics1_81_$LT$impl$u20$bevy_reflect..type_info..Typed$u20$for$u20$cmp..graphics..Sides$GT$9type_info17h2d4f02562378d1b3E".␍
          lib.def : error LNK2001: Nicht aufgelöstes externes Symbol "_ZN3cmp8graphics1_90_$LT$impl$u20$bevy_reflect..from_reflect..FromReflect$u20$for$u20$cmp..graphics..Sides$GT$12from_reflect17h8373a3f9dd382b4fE".␍
          lib.def : error LNK2001: Nicht aufgelöstes externes Symbol "_ZN3cmp8graphics1_90_$LT$impl$u20$bevy_reflect..tuple_struct..TupleStruct$u20$for$u20$cmp..graphics..Sides$GT$13clone_dynamic17h3353cfaa8143ce63E".␍
          lib.def : error LNK2001: Nicht aufgelöstes externes Symbol "_ZN3cmp8graphics1_90_$LT$impl$u20$bevy_reflect..tuple_struct..TupleStruct$u20$for$u20$cmp..graphics..Sides$GT$5field17h13206a0d6892ed5eE".␍
          lib.def : error LNK2001: Nicht aufgelöstes externes Symbol "_ZN3cmp8graphics1_90_$LT$impl$u20$bevy_reflect..tuple_struct..TupleStruct$u20$for$u20$cmp..graphics..Sides$GT$9field_mut17h14a60af13883f93cE".␍
          lib.def : error LNK2001: Nicht aufgelöstes externes Symbol "_ZN3cmp8graphics1_99_$LT$impl$u20$bevy_reflect..type_registry..GetTypeRegistration$u20$for$u20$cmp..graphics..Sides$GT$21get_type_registration17hdec5b11f70576bd1E".␍
          lib.def : error LNK2001: Nicht aufgelöstes externes Symbol "_ZN3cmp8graphics1_99_$LT$impl$u20$bevy_reflect..type_registry..GetTypeRegistration$u20$for$u20$cmp..graphics..Sides$GT$26register_type_dependencies17ha68b80319c65fe54E".␍

Additional information

In my case, Sides is the type that doesn't have Reflect, and NavComponent is a struct with a Sides field, but NavComponent itself has a Reflect derive.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ReflectionRuntime information about typesC-BugAn unexpected or incorrect behaviorS-Needs-InvestigationThis issue requires detective work to figure out what's going wrong

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions