C2766 explicit specialization; 'std::hash<wxString>'

Building and customizing Audacity from the source code.
Forum rules
If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like
Post Reply
HalfNote5
Posts: 41
Joined: Sun Feb 18, 2018 3:40 pm
Operating System: OS X 10.9 Mavericks

C2766 explicit specialization; 'std::hash<wxString>'

Post by HalfNote5 » Thu Dec 31, 2020 6:04 am

Hi all!

EDIT: This is a Windows build, using Visual Studio.

I'm trying to compile 2.2.2 with ASIO (no, we're not going to get into a long, lengthy discussion of WHY. It's a thing that's happening.) :D

Anyhoo, The compile seems to come to a screeching halt on MemoryX.h

I get:

Severity Code Description Project File Line Suppression State
Error C2766 explicit specialization; 'std::hash<wxString>' has already been defined Audacity c:\projects\audacity-audacity-2.2.2\src\MemoryX.h 1182

Which would seem to indicate that, indeed, there's already a wxString called hash somewhere else.

My question?

What do I do to work around this error?

I'm not familiar enough with 2.2.2 source to chase it down quickly, and time's the one thing I'm a bit short on. Thanks!

Much appreciation, in advance.



FURTHER INFO:

CMD line compile yields this gem:

c:\projects\audacity-audacity-2.2.2\src\MemoryX.h(1182): error C2766: explicit specialization; 'std::hash<wxString>' ha
s already been defined [C:\projects\audacity-Audacity-2.2.2\win\Projects\Audacity\Audacity.vcxproj]
C:\Users\redacted\git\wxWidgets\wxWidgets\include\wx/string.h(3986) : see previous definition of 'hash<wxString>

steve
Site Admin
Posts: 81443
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: C2766 explicit specialization; 'std::hash<wxString>'

Post by steve » Thu Dec 31, 2020 11:50 am

It's been too long since I built 2.2.2 to recall details, but a few tips:

1. Follow all of the instruction in the the Windows build.txt file exactly.

2. Ensure that you use the version of MSVC specified in the build.txt

3. Ensure that you use the version of WxWidgets specified in the build.txt

4. Ensure that the environmental variable for wx is actually set - reboot and check again. (I recall that this caused me major problems due to a bug in Windows - Windows said it was set, then after rebooting it wasn't set :evil: )

5. After building / installing WxWidgets, reboot the computer and then build one of the example apps to check that wx is correctly installed and working.

6. Make a normal build first. Once that works correctly, the ASIO build should be straightforward.

7. If it fails, clean everything and start again from the beginning.


Sorry I can't be more helpful, but the current build system has changed quite a lot since 2.2.2.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Post Reply