HateDread
Topic Author
Posts: 72
Joined: 06 Feb 2020, 10:27

Ambiguous symbol in Noesis Utils vs main lib - C++ Unity build

08 Jan 2024, 07:10

EDIT: Please disregard - I realized I *never* upgraded my NoesisGUI version, so this is years out of date. Worth trying the NsApp in a Unity C++ build at some point if you're curious, however.

--------------------------------------------

This is mostly by my own doing but I thought I'd pass it on in case you wanted to adjust the utils you provide (NsApp etc), which I moved into my own lib called "NoesisUtils" in my repository, with includes from NsApp, NsRender, and NoesisUtils.h.

There's a collision between NsApp/TriggerCollection.h and the main library's NsGui/FrameworkElement.h with regards to the symbol "TriggerCollection". If you try to build this utils lib with a unity build (i.e. all .cpp files squashed together automatically for better build times), you get the following
2>C:\_Development\Repositories\rtg\libs\NoesisUtils\Private\Interaction.cpp(80,5): error C2872: 'TriggerCollection': ambiguous symbol
2>(compiling source file 'CMakeFiles/NoesisUtils.dir/Unity/unity_3_cxx.cxx')
2>C:\_Development\Repositories\rtg\third_party\Noesis\Include\NsGui\FrameworkElement.h(43,35):
2>could be 'Noesis::UICollection<Noesis::BaseTrigger> Noesis::TriggerCollection'
2>C:\_Development\Repositories\rtg\libs\NoesisUtils\Public\NsApp\TriggerCollection.h(27,32):
2>or       'NoesisApp::TriggerCollection'
2>C:\_Development\Repositories\rtg\libs\NoesisUtils\Private\Interaction.cpp(80,58): error C2872: 'TriggerCollection': ambiguous symbol
2>(compiling source file 'CMakeFiles/NoesisUtils.dir/Unity/unity_3_cxx.cxx')
2>C:\_Development\Repositories\rtg\third_party\Noesis\Include\NsGui\FrameworkElement.h(43,35):
2>could be 'Noesis::UICollection<Noesis::BaseTrigger> Noesis::TriggerCollection'
2>C:\_Development\Repositories\rtg\libs\NoesisUtils\Public\NsApp\TriggerCollection.h(27,32):
2>or       'NoesisApp::TriggerCollection'
2>C:\_Development\Repositories\rtg\libs\NoesisUtils\Private\Interaction.cpp(83,9): error C2039: 'GetAssociatedObject': is not a member of 'Noesis::UICollection<Noesis::BaseTrigger>'
2>(compiling source file 'CMakeFiles/NoesisUtils.dir/Unity/unity_3_cxx.cxx')
2>C:\_Development\Repositories\rtg\third_party\Noesis\Include\NsGui\UIElement.h(34,25):
2>see declaration of 'Noesis::UICollection<Noesis::BaseTrigger>'
2>C:\_Development\Repositories\rtg\libs\NoesisUtils\Private\Interaction.cpp(84,22): error C2039: 'Detach': is not a member of 'Noesis::UICollection<Noesis::BaseTrigger>'
2>(compiling source file 'CMakeFiles/NoesisUtils.dir/Unity/unity_3_cxx.cxx')
Here are the two sources.

NsGui/FrameworkElement.h:
template<class T> class UICollection;
typedef UICollection<BaseTrigger> TriggerCollection;
NsApp/TriggerCollection.h:
template<class T> class UICollection;
typedef UICollection<BaseTrigger> TriggerCollection;
I can try and make some changes locally but I thought I'd mention it in case that collision could be resolved in some future version, though fairly low impact/priority I know :)

Thanks!

EDIT: The local fix was to change this in the Noesis lib provided header BaseTrigger.h, and any header that referenced it
template<class T> class UICollection;
typedef Noesis::UICollection<Noesis::BaseSetter> BaseSetterCollection;
typedef Noesis::UICollection<Noesis::BaseTrigger> BaseTriggerCollection; // was previously 'TriggerCollection'
typedef Noesis::UICollection<Noesis::TriggerAction> TriggerActionCollection;
 
User avatar
sfernandez
Site Admin
Posts: 2997
Joined: 22 Dec 2011, 19:20

Re: Ambiguous symbol in Noesis Utils vs main lib - C++ Unity build

09 Jan 2024, 17:17

I created ticket #2999 to fix this issue because we need to properly disambiguate those symbols using the namespace.
 
User avatar
jsantos
Site Admin
Posts: 3925
Joined: 20 Jan 2012, 17:18
Contact:

Re: Ambiguous symbol in Noesis Utils vs main lib - C++ Unity build

10 Jan 2024, 11:54

Fixed, marking as solved

Who is online

Users browsing this forum: Galilman and 3 guests