Difference between revisions of "Developing On Windows"

From Audacity Wiki
Jump to: navigation, search
(Build wxWidgets, set the environment variable, build Audacity)
({{ednote|'''Peter 20Apr19:''' old contents of page archived on the Talk page. }})
 
(51 intermediate revisions by 5 users not shown)
Line 1: Line 1:
'''Related pages:'''
+
{{alert|1=This page has been superseded by '''[[Building On Windows]]'''.}}
  
* [[Developing On Linux]]
 
* [[Developing On Mac]]
 
* [[ Developer Guide]]
 
<br/>
 
__TOC__
 
  
{{Hint|It can help to work in stages.  It's probably not advisable to try to do all the steps on this page in one session.}}
+
{{ednote|'''Peter 20Apr19:''' old contents of page archived on the Talk page. }}
 
 
==Visual Studio Express and Microsoft SDK==
 
* First get comfortable with Microsoft's free Visual Studio C++ Express. At the time of writing (November 2011), all developers are using the 2008 version which can be found [http://www.microsoft.com/visualstudio/en-us/products/2008-editions/express here].
 
* To develop in C/C++ for Windows you need a second download from Microsoft, the "Platform SDK", or the later "Windows SDK". [http://msdn.microsoft.com/en-us/windows/dd146047.aspx Check here] for the one you require.
 
* Don't forget to do a 'Windows Update' for any recent changes.
 
 
 
With MSVC set up you can write 'hello world' and similar small programs just to check things out, or use some of the examples that Microsoft provides. There is a Microsoft [http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=161&SiteID=1  Forum for Visual C++ Express] where you can get help with the program if you need it.
 
 
 
===What about Visual Studio 2010?  Or 64-bit?===
 
It is strongly recommended that you use VS2008.  The (free) VS2008 Express version is just fine for building Audacity.  The core developers have no intention of moving to MSVC 2010, due (a) to the 'This is for evaluation purposes only' MSVC 2010 Express splash screen and (b) bugs in MSVC 2010 Express that are not present in MSVC 2008 Express.  If you're still keen to try:
 
 
 
* As at April 2011, 3 projects in the solution will not build in VS 2010. wxWidgets steps must be followed closely and built targeting 32-bit, as must Audacity. Portaudio-v19, mod-script-pipe and of course Audacity will not build due to a number of MS compiler errors. Taglib would not build either, but is not currently in use in Audacity and no longer included in the solution file.
 
* Several people have had a go at building Audacity with VS 2010. 
 
** Andreas Micheler has succeeded, after making some mods to the code. 
 
** Ed Musgrove has succeeded, also after various mods. See this [http://forum.audacityteam.org/viewtopic.php?f=19&t=61946 Forum topic] for details.
 
<ul style="list-style-image: none; list-style-type: none">If you are adventurous, you're encouraged to contact either person and post consolidated tips/experience here.<p>It's a good idea to FIRST build with 2008 before attempting anything with 2010. Also check [http://bugzilla.audacityteam.org/show_bug.cgi?id=178 Bug 178] for the current known status of building in VS 2010. </p> </ul>
 
 
 
* VS 2010 apparently cannot build binaries that run on Windows 2000, XP RTM or Windows XP Service Pack 1. We still support those platforms. See this [http://stackoverflow.com/questions/2664607/issue-using-visual-studio-2010-compiled-c-dll-in-windows-2000 stackoverflow discussion].
 
 
 
* Audacity is known NOT to be 64-bit ready.  This currently also prevents long recordings in Audacity working correctly - with high sample rates 4 hours is about the limit. Fixing this requires a comprehensive review of Audacity, not just a fixing of the many errors flagged by the compiler.  It's a large task, and not currently a priority.
 
 
 
==Download wxWidgets==
 
Next get a recent version of [http://www.wxwidgets.org/ wxWidgets]. If you want to work with cutting edge code in Audacity, use [http://sourceforge.net/projects/wxwindows/files/2.8.12/wxMSW-2.8.12-Setup.exe/download wxWidgets 2.8.12] (the version officially supported by Audacity as at December 2011). Follow the instructions in the wxWidgets [http://www.wxwidgets.org/docs/ documentation] to get some of the wxWidgets samples to compile. For in-depth reference there is a 700-page book: [http://wxwidgets.org/book/index.htm Cross-Platform GUI Programming with wxWidgets] which is also available as a [http://www.phptr.com/content/images/0131473816/downloads/0131473816_book.pdf PDF download]. Time spent reading the documentation and trying things out is time well spent.  There is one detail in setting up wxWidgets which is very important.  It's setting up the $(WXWIN) environment variable.  It's not set by the installer.  It must be set correctly to your wxWidgets directory if you're to compile Audacity.  wxWidgets can be compiled in many different modes, such as Unicode and ANSI, debug and release, library or dll.  If you want to work with the latest Audacity code, make sure that amongst the versions of wxWidgets that you compile is the DLL Unicode Debug version.
 
 
 
:'''Don't try moving on further until you have at least one sample wxWidgets program compiled and running!'''
 
 
 
== Set up for SVN ==
 
For Windows, [http://tortoisesvn.net/ TortoiseSVN] is possibly the easiest client to use to get the code from [http://code.google.com/p/audacity/source/checkout the repository]. It adds extra right-click menu items to the Explorer file manager. These are used for synchronising your local copy of the files with the repository.  Any user can read the files and that's all you need at this stage.
 
 
 
Once TortoiseSVN is installed, in Explorer, create a folder for the source, right-click on it and select 'SVN Checkout...' then paste
 
:<pre>http://audacity.googlecode.com/svn/audacity-src/trunk/</pre>
 
into the first box and hit 'OK'. Wait a bit and you should have the source (about 230MB, May 2010).
 
 
 
If you have problems checking out the code, please e-mail our [http://audacity.sourceforge.net/contact/#feedback feedback address] so we can look into it. 
 
 
 
== Compiling wxWidgets and Audacity ==
 
In May 2008 we made significant changes so that we build Audacity ''modularly''. In the past, Audacity was always built against a custom monolithic non-DLL build of wxWidgets. This let us use multi-threaded wxWidgets while having Audacity as a single executable. But now we want to use plug-in modules in Audacity, and the modules and Audacity must both link to wxWidgets. Unfortunately it is not possible to embed the wxWidgets dll's into Audacity and share them as static links. So, Audacity will ship with these dll's and link to them dynamically. On the other hand, DLL builds of wxWidgets are automatically multi-threaded, so we no longer need a custom wxWidgets build. 
 
 
As of 20 June 2008, there are now four configurations of Audacity, all modular. To build each, first build the appropriate configuration of Widgets for your required build of Audacity:
 
 
 
{|width="90%" align="center" style="background:#EEEEEE"
 
|-valign="top" align="left"
 
!Audacity configuration !! Purpose !! Required wxWidgets build
 
|-valign="top"
 
|width="25%"|Release||width="50%"|General non-Unicode use||width="25%"|DLL Release
 
|-valign="top"
 
|Unicode Release||General Unicode-based use||DLL Unicode Release
 
|-valign="top"
 
|Debug||Slower performance, debuggable, no Unicode support||DLL Debug
 
|-valign="top"
 
|Unicode Debug||Slower performance, debuggable, Unicode support||DLL Unicode Debug
 
|}
 
 
 
=== Build wxWidgets, set the environment variable, build Audacity===
 
There are excellent instructions in the online [http://audacity.googlecode.com/svn/audacity-src/trunk/win/compile.txt compile.txt]. Building Widgets is straightforward, but it's worth repeating that you need to exit Visual Studio and set the WXWIN environment variable before building Audacity. 
 
 
 
Set the <tt>WXWIN</tt> environment variable to "C:\wxWidgets-2.8.12" assuming you installed wxWidgets 2.8.12 into its standard location of C:\. To do this:
 
* '''Windows 2000 and later:''' Right-click over "My Computer", then follow any "Advanced" links to arrive at "System Properties". Click on "Advanced" then "Environment Variables". Add a user or system variable with name "WXWIN" and value "C:\wxWidgets-2.8.12" (without quotes).
 
* '''Windows 98/ME:''' edit AUTOEXEC.BAT to add a line "set WXWIN=C:\wxWidgets-2.8.12" (without quotes). It's safest to do this by running MSCONFIG, and click "New" on the "Autoexec.bat" tab.
 
 
 
{{Advice|It is highly recommended to reboot the computer after setting WXWIN. It is definitely essential on Windows 98/ME, and in practice seems to be required on later versions of Windows too.}}
 
 
 
{{Advice|You need to make a few configuration settings as described in [http://audacity.googlecode.com/svn/audacity-src/trunk/win/compile.txt compile.txt] (or in wiki-layout [[Windows compilation notes‎‎]]).}}
 
 
 
{{Hint|'''Other problems?'''<p>For more help if the build fails, see [http://wiki.wxwidgets.org/Troubleshooting_building_wxWidgets_using_Microsoft_VC Troubleshooting building wxWidgets using Microsoft VC]</p>}}
 
 
 
===Common Compilation Errors===
 
* '''Setup.h not found:''' <br>If when you try to compile Audacity you get errors about "Setup.h" not being found, that could mean:
 
**'''a)''' You have not compiled wxWidgets in the right version for the version of Audacity you are trying to build (e.g. incorrect Unicode choice - You must select "DLL Unicode Debug" or "DLL Unicode Release" and NOT "DLL Universal Unicode Debug/Release") OR
 
**'''b)''' Your $(WXWIN) environment variable is wrong. For it to take effect after a change you must restart Visual Studio or better, reboot.
 
 
 
* '''unistd.h not found:'''
 
**Add "..\..\lib-src\libsamplerate\Win32" to INCLUDE path (C/C++->General->Additional Include Directories) for the project that fails to build with this error (usually - libid3tag).
 
 
 
* '''wx*26ud.lib not found when building in Unicode_Debug configuration:'''
 
**Change wx*26ud to wx*28ud for Audacity project (In Visual Studio: Project > Audacity Properties > expand Configuration Properties > Linker > Input > Additional Dependencies).
 
**Make sure you built wxWidgets in Unicode Debug configuration.
 
**This applies to all similar errors (with other configurations) - first check that dependencies has the right version, then check that these files exist at all.
 
 
 
{{Hint|1='''Still got problems?'''
 
*Try pasting the error messages into a Google search box.  Many of the compiler and linker error messages are fairly cryptic unless you've seen them before, but there are often messages in web-searchable e-mail lists explaining what they mean and what to do.
 
*For more help, see the file win/compile.txt in the Audacity source code. If you are still stuck, please ask on the [http://forum.audacityteam.org/viewforum.php?f=19 Compiling Audacity] section of our [http://forum.audacityteam.org Audacity Forum].}}
 
 
 
 
 
[[Category:Windows Platform]]
 
[[Category:For Developers]]
 

Latest revision as of 09:54, 20 April 2019

Warning icon This page has been superseded by Building On Windows.


Peter 20Apr19: old contents of page archived on the Talk page.