Unable to compile with Visual Studio 2017

Building and customizing Audacity from the source code.

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

Unable to compile with Visual Studio 2017

Permanent link to this post Posted by Yarn366 » Thu Jun 08, 2017 4:45 am

Whenever I try to compile Audacity in Visual Studio 2017, the projects libnyquist, libsndfile, and lv2 throw this error:

#error: Macro definition of snprintf conflicts with Standard Library function declaration


I'm following this guide, except I'm using wxWidgets 3.0.3 without the patch, because 3.0.2, with or without the patch, throws the same error. When I open the Audacity solution file, VS asks whether to upgrade the project; I let it do so, because if I don't, then compilation fails because the v120_xp build tools aren't installed (and I don't think I can install them).
Yarn366
 
Posts: 8
Joined: Sat May 20, 2017 11:31 pm
Operating System: Windows 7

Re: Unable to compile with Visual Studio 2017

Permanent link to this post Posted by steve » Thu Jun 08, 2017 9:00 am

Yarn366 wrote:I'm following this guide,

That guide says:
Audacity releases for Windows are currently built with Microsoft Visual Studio 2013 C++


The Express edition is no longer available, so you will need to use the Community edition.

You may also find this page useful. It's some proposed updates to the instructions and aims to clarify some points in the current instructions: http://wiki.audacityteam.org/wiki/Talk: ... On_Windows
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 44458
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Unable to compile with Visual Studio 2017

Permanent link to this post Posted by Gale Andrews » Thu Jun 08, 2017 1:16 pm

Yarn366 wrote:I'm using wxWidgets 3.0.3 without the patch

That's not supported either. Build with VS2013 Community Edition and wxWidgets 3.0.2.


Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual
Gale Andrews
Quality Assurance
 
Posts: 26093
Joined: Fri Jul 27, 2007 12:02 am
Operating System: Windows 10

Re: Unable to compile with Visual Studio 2017

Permanent link to this post Posted by Yarn366 » Thu Jun 08, 2017 9:17 pm

Using VS Community 2013 and wxWidgets 3.0.2 worked.

To be honest, I thought that the Visual Studio installer linked at the top of this page would just download and install whatever the latest version of Visual Studio happened to be (2017 currently). Good thing I was wrong. (And that was the day after the link was fixed.)
Yarn366
 
Posts: 8
Joined: Sat May 20, 2017 11:31 pm
Operating System: Windows 7

Re: Unable to compile with Visual Studio 2017

Permanent link to this post Posted by henric » Fri Jun 09, 2017 11:54 am

Yarn366 wrote:Whenever I try to compile Audacity in Visual Studio 2017, the projects libnyquist, libsndfile, and lv2 throw this error:

#error: Macro definition of snprintf conflicts with Standard Library function declaration


I'm following this guide, except I'm using wxWidgets 3.0.3 without the patch, because 3.0.2, with or without the patch, throws the same error. When I open the Audacity solution file, VS asks whether to upgrade the project; I let it do so, because if I don't, then compilation fails because the v120_xp build tools aren't installed (and I don't think I can install them).


Many of the VS2013->VS2015/VS2017 compile problems come from the various stdint.h and inttypes.h files included to allow builds with versions of Visual Studio older than VS2012 where the included SDK did not provide those header files (or was it VS2013?). The SDK that comes with VS2015 started relying on the Microsoft versions of those files, so providing custom ones that override the system's headers causes a lot of grief. There are also a few #if changes needed in a few places. You may want to look at the now ancient "henricj" pull requests for the official audacity or look at the "Update _MSC_VER #if blocks." change here: https://github.com/henricj/audacity/commits/x64 (the link to the actual commit changes when I rebase on top of new changes from the main audacity archive).

I would not recommend using my fork unless you are comfortable reading through the changes that have made there. Cherry-picking the changes you need would be safer. I rarely do anything other than smoke test a VS2017/v141 x64 build that is statically linked against an LTCG build of the head of the wxWidgets tree. If you do want to build it, set WXWIN_VS2017 to point to wxWidgets (3.0.3, 3.1, and HEAD should all work, but recently I've only tested HEAD; 3.0.3 would be the most conservative choice), make sure the VS2017 installer set VS150COMNTOOLS (IIRC, run the installer again to make sure you have Update 2 if that is not the case), run the "build_wx2017.bat" in the "win" directory to get the wxWidgets stuff built, then "build_2017.bat" to build audacity itself. Take a look in "win\build\bin\v141\x64\Static Release" and hopefully there should be an audacity.exe. If you need the translations, you will need to copy them from the "Release" directory ("Static Release" only relinks what was done for "Release", so the Language stuff isn't re-generated).

This may also be of interest: https://sourceforge.net/p/audacity/mailman/message/35836832/
henric
 
Posts: 29
Joined: Sun Jan 17, 2016 9:12 pm
Operating System: Windows 10

Re: Unable to compile with Visual Studio 2017

Permanent link to this post Posted by Gale Andrews » Fri Jun 09, 2017 12:05 pm

Yarn366 wrote:To be honest, I thought that the Visual Studio installer linked at the top of this page would just download and install whatever the latest version of Visual Studio happened to be (2017 currently). Good thing I was wrong.

Is the text on that page not clear as to what will be downloaded? From my testing it gets VS2013 Community Edition Update 4.

Stating the obvious, we cannot fix the link until we know it has become broken. The problem arises from Audacity only supporting obsolete versions of VS, but then it is work for us to upgrade too.


Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual
Gale Andrews
Quality Assurance
 
Posts: 26093
Joined: Fri Jul 27, 2007 12:02 am
Operating System: Windows 10

Re: Unable to compile with Visual Studio 2017

Permanent link to this post Posted by Yarn366 » Fri Jun 09, 2017 8:05 pm

Gale Andrews wrote:Is the text on that page not clear as to what will be downloaded? From my testing it gets VS2013 Community Edition Update 4.

Stating the obvious, we cannot fix the link until we know it has become broken. The problem arises from Audacity only supporting obsolete versions of VS, but then it is work for us to upgrade too.


Gale


The text is clear enough. Before I actually tried to run the installer, though, I thought that any "vs_community.exe" from Microsoft, including the one linked to in the guide, would just download and install the newest version of Visual Studio. (There are plenty of outdated guides, and not just for Audacity, that provide links that are supposed to point to particular versions of software that now actually point to newer versions, because either the links point to web installers that only install the latest versions, the links are for the main product pages that only offer the newest versions, or the link targets turned into redirects to the main product pages. Looking at the history of that guide, I can see that before June 6, 2017, that link was the second of these.)
Yarn366
 
Posts: 8
Joined: Sat May 20, 2017 11:31 pm
Operating System: Windows 7


Return to Compiling Audacity



Who is online

Users browsing this forum: No registered users and 3 guests