Talk:Developing On Windows
- 1 Proposed new text for compile.txt
- 2 Proposed additional text for Wiki (only)
- 3 2008 and Earlier
Proposed new text for compile.txt
Audacity releases for Windows are built with Microsoft Visual Studio 2013 C++. Most of us use the Express edition, which is free.
Fuller build instructions can be found on our wiki at
These include information on:
- Obtaining and installing MSVC 2013 C++
- Building the optional installer.
- Dlls that accompany the exe.
- Optional language support
- Optional help files
- Optional features, including building with ASIO
- The Git revision identifier
- Signing the installer
- Linker errors
- Very old instructions for building with Cygwin rather than MSVC
- Experimental builds for 64 bits
- Experimental modules
Install MSVC 2013 C++
Download Audacity's patched wxWidgets 3.0.2 zip from the Audacity fork of the wxWidgets project:
(use the green "clone or download" button on the right).
Open "C:\wxWidgets-3.0.2\build\msw\wx_dll.dsw" with Microsoft Visual Studio. Make sure to use wx_dll.dsw, not wx.dsw. When you open wx_dll.dsw, Visual Studio will prompt whether to convert. Click "Yes To All".
Next time you open a Visual Studio session, you can avoid this prompt by opening "C\wxWidgets-3.0.2\build\msw\wx_dll.sln" instead of wx_dll.dsw.
Build wxWidgets for the configurations of Audacity that you want.
- Use the "DLL Release" configuration to use in a "Release" version of Audacity.
- Build "DLL Debug" configuration to use in a "Debug" version of Audacity.
Do not build the Release and Debug versions.
Build the entire solution. ODBC won't build successfully, but that is OK as it is not used by Audacity. You will need to repeat 'build solution' several times until all dependencies have been built.
For Audacity, you need only the following seven projects to build (not the whole solution) for each configuration: * adv * base * core * html * net * qa * xml Building only these will give you a faster build, and possibly smaller wxWidgets DLLs. To do this, Ctrl-select those 7 projects in the Solution Explorer. Then right-click and choose Build Selection (or Rebuild Selection). Because of dependencies, this should also build the following projects. But on some computer configurations, they may not on VS2013, so you might have to explicityly build these as well: * wxexpat * wxjpeg * wxpng * wxregex * wxtiff * wxzlib To be certain about this, you can just Ctrl-select them with the others above, and build them all together. If you build the whole solution, ignore the linker errors for wxbase30*_odbc*.* dbgrid.
Set wxWidgets location for Audacity
Close MSVC if it is open.
Set the system variable WXWIN to the location of wxWidgets 3.0.2 To do this run cmd as administrator. From the start/find button in bottom left of the screen, type:
and press CTRL+SHIFT+ENTER. This will give a security prompt to confirm. Then in the cmd window, running as admin, type
setx WXWIN "C:\wxWidgets-3.0.2" /m
Then close the cmd window.
Alternative slightly longer steps are given on our wiki.
Download Audacity Source
Checkout the latest Audacity code from our GitHub repository at
(see GitHub for help).
Run Visual C++ and load the Audacity solution, "audacity\win\audacity.sln".
Select the configuration that you wish to build:
- "Release" for Unicode-based, general use
- "Debug" for a Unicode-based, slower, debuggable executable
You can select the configuration from the Solution Configurations pull-down menu, or select it from the "Build" menu > "Configuration Manager..." dialog box.
Build Audacity by giving the "Build" menu > "Rebuild Solution" command.
Add DLLs to your path
Proposed additional text for Wiki (only)
Help I Got Linker Errors
In some cases, Audacity does compile, but during the linking process you get a bunch of error messages like this:
LIBCMTD.lib(LIBCMTD.dll) : error LNK2005: _free already defined in MSVCRTD.lib(dbgheap.obj)
This is usually caused by conflicting runtime library settings. Audacity is now linked with DLL linkage and our windows project file ONLY has DLL linkage, so we think this problem has gone. If it does happen, check the following:
In MSVC 2013, select the Audacity project. Then
Project > Properties > Configuration Properties > C/C++ > Code Generation > Runtime Library
"Multi-threaded Debug DLL (/MDd)" for Debug builds,
"Multi-threaded DLL (/MD)" for Release builds.
Make sure you set the correct library type for all corresponding build configurations. Also make sure you check all other libraries, like the Ogg Vorbis libraries, if you have them installed.
You may want to use the /VERBOSE:LIB linker parameter to get information about which library is causing the conflict.
If all else fails, use the following procedure to force Audacity to link to the correct library:
Select the Audacity project in Solution Explorer. Then choose Project > Properties.
Select the desired configuration (e.g., "Debug" or "Release"). Select the "Linker" folder in the tree on the left, and the "Input" item. In the "Ignore Specific Library" field, enter "msvcrt.lib" if you were attempting to perform a Release build, or "msvcrtd.lib" for a Debug build.
On some systems, you will need to ignore "libcmt.lib" or "libcmtd.lib" instead of "msvcrt.lib" or "msvcrtd.lib", depending on the library which actually causes the conflict.
Note that if you have configured all libraries correctly, none of the above should actually be necessary.
If you still receive errors, it often helps to try it again with a clean installation of the wxWidgets sources and the latest Audacity source from GitHub. Also check "Common compilation errors" on: http://wiki.audacityteam.org/wiki/Developing_On_Windows#common for more assistance.
DLLs that accompany Audacity
Each Audacity executable needs access to seven specific wxWidgets DLLs. You can copy them to your Windows PATH, or more simply, to the same directory as the executable.
If you are building Audacity for public release using the *.iss installer script, you must copy them to the executable directory. The DLLs required are at "C:\wxWidgets-3.0.2\lib\vc_dll":
wxbase30*_net_vc_custom.dll wxbase30*_vc_custom.dll wxmsw30*_adv_vc_custom.dll wxmsw30*_core_vc_custom.dll wxmsw30*_html_vc_custom.dll wxbase30*_xml_vc_custom.dll wxmsw30*_qa_vc_custom.dll
The "*" in the file names above is replaced in the actual files by a suffix specific to its Widgets configuration. You can identify the DLLs needed for each Audacity version as follows:
"u" for "Unicode Release" versions "ud" for "Unicode Debug" versions
So for instance, a Debug version of Audacity should have:
wxbase30ud_net_vc_custom.dll wxbase30ud_vc_custom.dll wxmsw30ud_adv_vc_custom.dll wxmsw30ud_core_vc_custom.dll wxmsw30ud_html_vc_custom.dll wxbase30ud_xml_vc_custom.dll wxmsw30ud_qa_vc_custom.dll
in the "audacity\win\Debug" directory.
Locally installed help is optional, but required for a full Release build. (The "help" folder is included in the installer, but removed from the zip distribution.) The Python library is required, obtainable from http://www.python.org/download/ . Add the location of the top-level directory where you installed Python to your Path environment variable. For instructions on setting environment variables, see the previous section, "MSVC++ STEP 4: Set wxWidgets location for Audacity".
Build the "help" project by enabling it in the MS Visual Studio Configuration Manager (Build menu). This will download a copy of the Manual wiki onto your machine and copy it to the correct place for your build. If the local copy needs to be updated, run audacity\scripts\mw2html_audacity\wiki2htm.bat and re-build the "help" project.
To support languages other than English in your build of Audacity, you must enable and build the optional "locale" project. This is required for a full release. You will need to obtain msgfmt.exe from https://sourceforge.net/projects/cppcms/files/boost_locale/gettext_for_windows/
Add the location of the directory containing msgfmt.exe to your Path
environment variable. Alternatively, put msgfmt.exe somewhere already in the Path, e.g., C:\Windows.
Some functionality in Audacity is currently turned on in its default configuration, but requires that extra libraries be downloaded separately to use it.
To change the libraries enabled in Audacity, edit "win\configwin.h" and comment or uncomment the entries.
Optional ASIO Support
To add support for ASIO:
ASIO (from Steinberg) is a sound card interface protocol that is faster than standard WMME. Unlike WMME, not all soundcard drivers support it.
Because ASIO is a proprietary, closed standard, we (or any third party) cannot distribute its SDK. That means we cannot distribute builds of Audacity that support ASIO, because Audacity is licensed under the GPL (http://audacityteam.org/about/license), which requires we distribute all source code.
So, although you can build your own copies of Audacity with ASIO support, for personal use, you cannot distribute them without violating the Audacity license and the ASIO license. If you build ASIO support into Audacity, do not distribute that build.
For ASIO support, get the ASIO SDK from Steinberg (http://www.steinberg.net/en/company/developers.html), install at C:\ASIOSDK, then define an environment variable called ASIOSDK_DIR.
The value should be the full path to the base directory of the ASIO SDK, e.g.,
"How can you tell whether ASIO is there? I know that I had installed the Soundcraft ASIO driver, and downloaded the ASIO SDK (version 2.3), and set up the path environment variable, but could not see any ASIO option in the list of audio hosts, even when I had the MTK connected.
I found some advice on a PortAudio forum, specifically: copy the entire ASIOSDK2.3 folder into:(Audacity-root)\lib-src\portaudio-v19\src\hostapi\asio Rename it from ASIOSDK2.3 to ASIOSDK.Having done this I re-built Audacity, and at first still couldn't see ASIO... but when I connected the MTK the ASIO option appeared as an audio host, and I could add multiple recording tracks in a single operation."
Optional XP Support
Audacity no longer supports Windows XP. If you want to build for XP, as a minimum you will need to rebuild both wxWidgets and Audacity with the 120_xp option.
Here's an alternative way to set WXWIN which also provides a way to check the value. The following is based on Windows 7, so you may need to make adjustments.
- Open the "Control Panel"
- Click the "System" app
- Click the "Advanced system settings" link
- On the "Advanced" tab, click the "Environment Variables..." button
- Click "New..." in the "System variables" group
- Set the "Variable name" to "WXWIN" (without the quotes)
- Set the "Variable value" to the full path of where you installed wxWidgets (typically "C:\wxWidgets-3.0.2")
- Click "OK" until you exit the "System Properties" app
|This next sets the environment variable, not the system variable. You need setx with the /m
option to set the system variable.
An alternative way to do it, that's available on all versions of Windows,
is to open a cmd.exe window, and type:
set WXWIN =C:\wxWidgets-3.0.2
Once you have set the WXWIN environment variable correctly, the Audacity Project file's declarations will do the rest.
Note that if you currently have the Audacity Solution open in Visual Studio, you must restart Visual Studio for it to recognize the new environment variables.
In some cases, you may need to reboot the computer to ensure the variables are read correctly.
2008 and Earlier
Gale 24May08 19:19 UTC: James, Thanks for correcting the mistake about what version of wxWidgets to build. Are you sure though that restarting MSVC is enough to pick up changed WXWIN environment variables. It does not work for me. If on XP I change the WXWIN from 2.8.7 to a non-existent path, restart MSVC and build Audacity, it still builds with 2.8.7.
- James 15:36, 24 May 2008 (PDT): It does work for me. I've just tested precisely as you suggested. Changing it to fail, and then changing it back to work. Behaved as I'd want it to. I'm on XP Pro, SP2. I have WXWIN in StartMenu->MyComputer->Properties->Advanced->EnvironmentVariables->UserVariablesForClient. In case this was the difference, I also tried it for WXWIN in StartMenu->MyComputer->Properties->Advanced->EnvironmentVariables->SystemVariables instead, and that works too. Puzzled why it doesn't work for you.
- Gale 25May08 19:23 UTC: Looks as if restarting the IDE should be enough on Win2000 and later from the research I have done, it works on my secondary XP box (and resetting the path for the Audacity dll's works at once even on my main XP box). Please verify my hint about winable.h error. I got this error building Widgets 2.8.7 on the other XP box although it has the identical Windows Server 2003 R2 Platform SDK and winable.h is in there (another environment variable problem)? Judging by it looks as if this error would occur building on Vista (?), but I don't seem to have any problems running Audacity with Widgets built with winable.h disabled.
- Gale 26May08 18:50 UTC: Leland confirms the winable.h error would arise from using a newer platform SDK, though I'm still not quite sure why this error is in the 2003 R2 platform SDK that I downloaded specially to the other machine to see if it corrected the error. Maybe on the main machine I never installed the SDK explicitly as it came with the ISO containing the full Visual Studio, whereas the older machine already had the SDK before installing Visual Studio? Whatever, Leland confirms we can just disable winable.h when building wxWidegts. Thanks.