Can not build audacity 2.0.3 with wxWidgets 2.8.12

I’m here because I believe I have tried EVERYTHING in order to build audacity 2.0.3 with wxWidgets 2.8.12 on Windows 7

Audacity project does compile well but I can’t get the final exe file.

I’m using VS C++ 2008 express, SDK 7.1 for Windows 7.

I compiled every configuration of wxWidgets 2.8.12 (Debug, Release, Dll Debug, Dll Release, Dll Unicode Debud, Dll Unicode release). I had no problem here and I even compiled a few samples. I set the WXWIN variable correctly.

Then, when I try to complie audacity I get many errors like this in the BuildLog.htm:

echo Project : error PRJ0019: A tool returned an error code from “Copying mand5”

Also, I get other few (11) compilation errors:


C:wxWidgets-2.8.12includewx/app.h(230) : warning C4002: too many actual parameters for macro ‘Yield’
C:wxWidgets-2.8.12includewx/app.h(230) : error C2059: syntax error : ‘{’
C:wxWidgets-2.8.12includewx/app.h(230) : error C2334: unexpected token(s) preceding ‘{’; skipping apparent function body
C:wxWidgets-2.8.12includewx/app.h(406) : warning C4002: too many actual parameters for macro ‘Yield’
C:wxWidgets-2.8.12includewx/app.h(406) : error C2059: syntax error : ‘=’
C:wxWidgets-2.8.12includewx/app.h(406) : error C2238: unexpected token(s) preceding ‘;’
C:wxWidgets-2.8.12includewx/msw/app.h(38) : warning C4002: too many actual parameters for macro ‘Yield’
C:wxWidgets-2.8.12includewx/msw/app.h(38) : error C2208: ‘bool’ : no members defined using this type
c:audacity-srcsrcwidgets…/Envelope.h(106) : error C2589: ‘(’ : illegal token on right side of ‘::’
c:audacity-srcsrcwidgets…/Envelope.h(106) : error C2059: syntax error : ‘::’
c:audacity-srcsrcwidgets…/Envelope.h(106) : error C2589: ‘(’ : illegal token on right side of ‘::’
c:audacity-srcsrcwidgets…/Envelope.h(106) : error C2589: ‘(’ : illegal token on right side of ‘::’
…srcexportExportCL.cpp(490) : error C2039: ‘Yield’ : is not a member of ‘wxApp’
C:wxWidgets-2.8.12includewx/msw/app.h(26) : see declaration of ‘wxApp’


Please, can somebody help me?

Well, finally I managed to solve the problems.

I didn’t think I must change the source code, but it was necessary for 3 files. Here are the modifications:

1 - Add a #define NOMINMAX at the very beginning of Audacity.h
2 - Add a #define PLATFORM_MAX_PATH 260 in the SimpleBlockFile.cpp
3 - Add a #include “wx/msw/winundef.h” in app.h


Now I wonder whether the developers or everyone else get these same errors or not… When I check out a new version, will I have to do it all again? :question:

Thanks

You should not be getting those errors - I compile every day with the same environment and Windows SDK as you.

In Visual Studio at Project >Audacity_Properties >Configuration_Properties >C/C++ > Precompiled_Headers do you see Precompiled Header File .$(ConfigurationName)/audacity.pch ?

Have you changed any settings in Visual Studio?

Were you following http://wiki.audacityteam.org/wiki/Developing_On_Windows ?


Gale

Thank you, Gale

Yes, I have “.$(ConfigurationName)/audacity.pch” where you mentioned.

I didn’t change any settings in VS 2008. It’s a straightforward instalation. First SKD 7.1, then VC 2008 C++

And finally, yes, I can say followed very rigorously all directions from http://wiki.audacityteam.org/wiki/Developing_On_Windows.

I got rid of these few inclusion conflicts, but I ended up with one link error, as follows:


Creating library C:audacity-srcwinUnicode ReleaseAudacity.lib and object C:audacity-srcwinUnicode ReleaseAudacity.exp
ExportCL.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual class wxClassInfo * __thiscall wxTimer::GetClassInfoW(void)const " (_imp?GetClassInfoW@wxTimer@@UBEPAVwxClassInfo@@XZ)
C:audacity-srcwinUnicode ReleaseAudacity.exe : fatal error LNK1120: 1 unresolved externals

I would like very much to have Audacity running with Asio but I couldn’t even compile without it.

If you have more directions, please, let me know.
Thank you
André

How?

Did your original errors before you modified the Audacity source occur when you were linking to the ASIO SDK? Or before you linked to the ASIO SDK?

To compile with ASIO, please see wincompile.txt (scroll down).

Also see “HELP! I get linker errors!” in that document.

I don’t think we can help if you are modifying the Audacity sources in unknown ways. If your intention is to build with ASIO then it is best to do a complete fresh checkout of the Audacity sources, make sure you have defined an environment variable called ASIOSDK_DIR, reboot, then try to build Unicode Release of Audacity again.


Gale

1 - Add a #define NOMINMAX at the very beginning of Audacity.h
2 - Add a #define PLATFORM_MAX_PATH 260 in the SimpleBlockFile.cpp
3 - Add a #include “wx/msw/winundef.h” in app.h

These are the only modifications I made in the code in order to eliminate compiling errors.

No. I didn’t play with anything about ASIO yet. I was just trying to build Audacity alone first.

I read but I couldn’t figure out a way to fix it.

Thank you Gale.
If you think I can get a binary file of Audacity with Asio for window 7 from someone else, please let me know.
Thanks,
André

But those changes should not be necessary.

Where did you get 2.0.3 sources from? If you have not already done so, I would suggest installing Tortoise SVN then checking out either the latest Audacity SVN code or the 2.0.3 tagged release from http://audacityteam.org/community/developers#svn .

In my experience if you want ASIO, it’s best to build linking to ASIO from a separate Audacity tree.

If you want to go back to Audacity without ASIO, remove the ASIOSDK_DIR environment variable, reboot, checkout a fresh Audacity into completely new tree then build from that.

If you build Audacity, add or remove the ASIOSDK_DIR environment variable then build from the same tree, you can hit problems.

You cannot, because an ASIO-enabled build is only for personal use and cannot be distributed to anyone else.

But if you can compile the development code without ASIO (and there is no reason you can’t) but you cannot compile with ASIO, the current development code now supports JACK for Windows . In turn, JACK supports ASIO.

So if you add a JACKSDK_DIR environment variable and set that variable to the path where you have JACK installed, Audacity will be compiled with JACK support. Configure JACK to use ASIO (see farther down http://jackaudio.org/jack_on_windows ) then start JACK. Then set the Audacity “Host” choice in Device Toolbar to JACK and you will have ASIO support in Audacity with (almost) no more latency than native ASIO support.

Note that because JACK is a way to get ASIO support in Audacity, it has not been decided if we’ll be releasing Audacity with JACK support. So as yet, please don’t distribute your JACK-enabled Audacity build to anyone else.


Gale

Dear Gale, finally I managed to build Audacity!

First, I realized that I was not actually using SKD 7.1 since I had only installed it but not registered for VS2008. I was actually using SKD 6.0a that comes with VS2008.

Well, first I configured SDK 7.1 to work with VS2008 (tricky… it took me a long time…)

Then, I rebuilt wxWidgets (only Dll Unicode Release).

Then I tried to rebuild Audacity from a fresh SVN checkout (HEAD version), but… I got again the “MAX_PATH undeclared” error…
I was really about to give up. But I tried once again…

I looked for the definition of “MAX_PATH”. I found out that another macro was defined: PLATFORM_MAX_PATH = 260 in Audacity.h
But PLATFORM_MAX_PATH was being set again to MAX_PATH since WXMSW was defined. Well, I removed MAX_PATH and put 260 directly (Audacity.h ln 103). Then I cleaned the project and rebuilt. Worked like a charm (lot of warnings, by the way)…

Concluding, I had to change one line of the code… I browsed the internet and found other few people struglling with the same problem. Isn’t it worth modifying the souce code in SVN?

Well, thanks for your help. I really like Audacity and I’m happy that a managed to build it (but it was not easy at all). Now, I’m going to try building with ASIO support.

Best regards
André
São Paulo, Brazil

Very good. Now I have Audacity with ASIO. Very easy now :slight_smile:

Thanks

Thanks for the update and thanks for looking for the solution.

Really, you could have done the one build with ASIO unless you really wanted one build with ASIO and one without.

You have only just now said exactly what the maxpath error was. Was it this:

SimpleBlockFile.cpp
......srcblockfileSimpleBlockFile.cpp(504) : error C2065:
'MAX_PATH' : undeclared identifier

If so, then we do know about this problem, but only one of our developers experiences it ( see http://audacity.238276.n2.nabble.com/TimeTracks-was-Re-audacity-r12077-committed-commit-a-large-patch-by-Maarten-Baert-td7557054i20.html#a7557180 if you have not already found that page).

Among the many solutions, this seems to be the best:

Index: src/blockfile/SimpleBlockFile.cpp
===================================================================
--- SimpleBlockFile.cpp	(revision 12257)
+++ SimpleBlockFile.cpp	(working copy)
@@ -57,6 +57,7 @@
 
 *//*******************************************************************/
 
+#include <wx/wx.h>
 #include <wx/filefn.h>
 #include <wx/ffile.h>
 #include <wx/utils.h>

Does it work for you?


Gale

Hi Gale,

I hadn’t seen before the link you mentioned ( http://audacity.238276.n2.nabble.com/TimeTracks-was-Re-audacity-r12077-committed-commit-a-large-patch-by-Maarten-Baert-td7557054i20.html#a7557180 )

I chose the following solution in order to eliminate the MAX_PATH error:

***** Modify Audacity.h

#ifdef WXMSW
#include “configwin.h”
#undef PLATFORM_MAX_PATH
#define PLATFORM_MAX_PATH 260 //-------------- only this line has been changed
#endif

I have no other problems compiling Audacity with ASIO now.

I have seen other people with the MAX_PATH error. Maybe it is a good idea to incorporate one of the solutions to the SVN HEAD version.

Audacity is a great software! Thanks for all developers!

Cheers
André

I would like to add another important observation: When compiling wxWidgets I had to set “wxUSE_ODBC” to 1 in C:wxWidgets-2.8.12includewxmswsetup.h. Then I compile the whole wxWidgets solution in DLL Unicode Release.

Otherwise, I would get errors with the Yield marcro, such as "error C2039: ‘Yield’ : is not a member of ‘wxApp’ " while trying to build Audacity

Cheers
André

Everyone on Audacity Team builds with “wxUSE_ODBC” set to 1, because to enable extra accessibility we replace “wxWidgets-2.8.12includewxmswsetup.h” with the “setup.h” in “audacitywinwxWidgets_additions” which sets “wxUSE_ODBC” to 1. This is as per wincompile.txt ( http://audacity.googlecode.com/svn/audacity-src/trunk/win/compile.txt ) .

Did you compile the whole widgets build or only compile the five Widgets solutions recommended in wincompile.txt (namely adv, base, core, html and net)?


Gale