View Issue Details

IDProjectCategoryView StatusLast Update
0001637NoesisGUIC++ SDKpublic2020-04-13 21:02
ReporterstevehAssigned Tojsantos 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version2.2.6 
Target Version3.0.0Fixed in Version3.0.0 
Summary0001637: 'PlaySoundA' is not a member of 'Noesis::GUI'
DescriptionHi guys, I've just decided to test out upgrading from 2.2.1 -> 2.2.6.

I've just hit a compile error caused by the WinAPI doing some #define to rename "PlaySound" to either "PlaySoundA" or "PlaySoundW".

The file which fails to compile is "IntegrationAPI.cpp". The issue is caused by the order of includes:

1. IntegrationAPI.cpp first includes IntegrationAPI.h. This declares a function called "PlaySound" in the GUI namespace.
2. It then includes NsDrawing/VGL.h which includes NsCore/SpinMutex.h which includes <windows.h>. This eventually includes "PlaySoundAPI.h" in the windows api which redefined PlaySound to either PlaySoundA / PlaySoundW depending on unicode settings.
3. This then causes a compile error because the definition does not match the name of the declaration.

Error is as follows (I've cut out all the other non-important include paths)

1>------ Build started: Project: NoesisGUI, Configuration: Release PcDx11_x64 x64 ------
1>IntegrationAPI.cpp
1>Note: including file: Z:\LicencedSoftware\NoesisGUI\2.2.6\NoesisSDK\Src\Packages\GUI\Core\Include\NsGui/IntegrationAPI.h
1>Note: including file: Z:\LicencedSoftware\NoesisGUI\2.2.6\NoesisSDK\Src\Packages\Core\Kernel\Include\NsCore/Kernel.h
1>Note: including file: Z:\LicencedSoftware\NoesisGUI\2.2.6\NoesisSDK\Src\Packages\Core\Kernel\Include\NsCore/Stream.h
1>Note: including file: Z:\LicencedSoftware\NoesisGUI\2.2.6\NoesisSDK\Src\Packages\Core\NSTL\Include\NsCore/String.h
1>Note: including file: Z:\LicencedSoftware\NoesisGUI\2.2.6\NoesisSDK\Src\Packages\Drawing\VGL\Include\NsDrawing/VGL.h
1>Note: including file: Z:\LicencedSoftware\NoesisGUI\2.2.6\NoesisSDK\Src\Packages\Core\System\Include\NsCore/SpinMutex.h
1>Note: including file: C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\windows.h
1>Note: including file: C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\mmsystem.h
1>Note: including file: C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\playsoundapi.h
1>z:\licencedsoftware\noesisgui\2.2.6\noesissdk\src\packages\gui\core\src\integrationapi.cpp(130): error C2039: 'PlaySoundA': is not a member of 'Noesis::GUI'
1>z:\licencedsoftware\noesisgui\2.2.6\noesissdk\src\packages\gui\core\include\nsgui\integrationapi.inl(13): note: see declaration of 'Noesis::GUI'
1>Done building project "NoesisGUI.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


I can fix locally by renaming "PlaySound" to "NsPlaySound" so it doesn't match the #define.
TagsNo tags attached.
PlatformAny

Activities

jsantos

jsantos

2020-03-13 11:35

manager   ~0006142

Ugh, not sure why we are not having that error here and nobody complained before but I think we should rename PlaySound to something different. Unicode macros in window are a nightmare.
steveh

steveh

2020-03-13 11:41

reporter   ~0006143

Yup, I fully agree :) In fact, I'd go as far to say that the entire WinAPI is a nightmare.

Others may not have an issue because I'm not building Noesis externally using the generated solution. We use premake and directly integrate the CPP / H files from Noesis into our game's solution, so Noesis is built as part of our solution / generated project as opposed to Noesis solution/project generated via the Python script. This means that we may have different build settings which may include different windows unicode settings, or API settings etc.
jsantos

jsantos

2020-03-13 11:46

manager   ~0006144

I love that idea of integrating CPP / H directly into your solution. And we want to support this way in the future (like for example providing a single .cpp (or just a few) with all Noesis inside). Any feedback to make your life easier about this is welcome. Thanks!
jsantos

jsantos

2020-04-13 14:37

manager   ~0006196

Last edited: 2020-04-13 21:02

View 2 revisions

I fixed this and also added WIN32_LEAN_AND_MEAN in all places we are including windows.h

Issue History

Date Modified Username Field Change
2020-03-13 10:46 steveh New Issue
2020-03-13 11:34 jsantos Assigned To => jsantos
2020-03-13 11:34 jsantos Status new => assigned
2020-03-13 11:35 jsantos Note Added: 0006142
2020-03-13 11:41 steveh Note Added: 0006143
2020-03-13 11:46 jsantos Note Added: 0006144
2020-03-13 12:00 jsantos Status assigned => feedback
2020-03-20 16:37 jsantos Target Version => 3.0.0
2020-04-13 14:37 jsantos Status feedback => resolved
2020-04-13 14:37 jsantos Resolution open => fixed
2020-04-13 14:37 jsantos Fixed in Version => 3.0.0
2020-04-13 14:37 jsantos Note Added: 0006196
2020-04-13 21:02 jsantos Note Edited: 0006196 View Revisions