Error compiling audacity in win10

First, I cloned the audacity project from GitHub to my local computer.(Audacity Version:2.3.3)
Then I downloaded the compression package of wxwidgets-3.0.2.


Then I started trying to compile the wxWidgets project:

  1. Decompress wxwidgets-3.0.2
  2. Put the unzipped folder in the root directory of Disk C (C: \ wxwidgets-3.0.2)
    3.Set environment variable WXWIN:C: \ wxwidgets-3.0.2
  3. Enter the directory: Audacity \ win \ wxWidgets_additions \ wxwidgets-3.0.2,Copy all the files to the directory: C: \ wxwidgets-3.0.2, and overwrite
    5.Enter the directory: C: \ wxwidgets-3.0.2 \ build \ MSW, and use vs2017 to open the wx_vc12.sln project file
    6.Compile wxWidgets project
    7.Compilation results.
    8.Enter the directory:C:\wxWidgets-3.0.2\src\tiff\libtiff,Modify the file: tif_config.h
    Modify:
#define snprintf _snprintf

To:

#if (defined(_MSC_VER) && (_MSC_VER < 1900))
       #define snprintf _snprintf
#endif

9.Enter the directory:C:\wxWidgets-3.0.2\src\zlib,Modify the file: gzguts.h
Modify:

#ifdef _MSC_VER
	#  define snprintf _snprintf
#endif

To:

#if (defined(_MSC_VER) && (_MSC_VER < 1900))
	#  define snprintf _snprintf
#endif

[/code]
10.Recompile wxWidgets project,Compiled successfully with no errors.

OK, now I’ll start compiling the audacity project.
1.Enter the directory:Audacity\win, and use vs2017 to open the file audacity.sln.
2.Then compile the project.
3.Compiled for a long time… :astonished:
4.Compilation completed with errors.
5.Click the error prompt to enter each error file.
6.Modify:

#include "wx/setup.h"

To:

#include "wx/msw/setup.h"

7.Recompile project Audacity.
8.After the compilation, there were errors again :frowning:
Now, I’m stuck here. I don’t know how to solve this problem, or there is a problem with my compilation process. If you know how to solve this problem, you can leave a message below or send me an email (mp07549676 @ gmail. Com),I will always pay attention to it. I’m very grateful to you for your view and help. It’s very important for me to solve this problem.

The latest build instructions for Windows are in the “win” directory of the Audacity source code: https://github.com/audacity/audacity/blob/master/win/build.txt
So here’s your first error:

3. wxWidgets:

 1) Clone wxWidgets and checkout 3.1.1 from the Audacity fork of the 
    wxWidgets project: 
       https://github.com/audacity/wxWidgets/

:astonished: :astonished: :astonished: :astonished: :astonished: :astonished: :astonished: :astonished: :astonished: Thank you. I’ll see if it’s the cause right away

I would also highly recommend that you do this “optional” step after installing wxWidgets:

  3) Having got this far, it is well worth trying out building some wxWidgets
    examples to confirm that building has worked OK

The reason being, that if wxWidgets is not correctly installed and working, then building Audacity will fail, probably with an obscure error.

As you said, I cloned the wxWidgets project from GitHub again and compiled it according to the process in build.txt, but there was still an error. I have two problems now. The first one is that I ran the samples in samples / minimal with an error. The second question is which one to use when compiling wxWidgets.

It’s been a long time since I built wxWidgets on Windows (I usually use Linux), but if I recall correctly, I used the GUI and built “wx_vc15.sln”.


I’ve just checked the Audacity build.txt, and that says (emphasis added):

  1. Follow instructions for building at
    https://github.com/audacity/wxWidgets/blob/v3.1.1/README-GIT.md
    https://github.com/audacity/wxWidgets/blob/v3.1.1/docs/msw/install.txt

DO set WXWIN to the appropriate directory where you installed wxWidgets.
To do that, open a cmd.exe window, and type:
set WXWIN=C:\wxWidgets-3.1.1

You will be building a dll version with MSVC2017 IDE, so…

In MSVC 2017 open wx_vc15.sln, and select dll, release.

Then build.

The biggest problem that I had when building wxWidgets, was getting the environmental variable to stick. Windows appears to be buggy doing this and I had to do it several times before the setting stuck. I’d suggest that after setting the environmental variable, reboot the computer and check that it really is set.

Yes, that’s right. The two web pages that I always open on my desktop now, I also compile according to the process written on the two web pages. The first web page, first copy the setup0. H file under the directory: Include / Wx / MSW /, and change its name to setup. H. then enter the second web page, I used vs2017, so I directly opened the directory: wx_vc15.sln project file under build \ MSW. Then I started compiling. I also don’t remember whether there was an error during the compilation, because I compiled the project several hours ago.But at least now I open the widgets project, and there are no compilation errors.During that time, I also wanted to test whether the widgets were compiled successfully, so I went to the directory: \ samples \ minimal and opened the file: minimal_vc15.sln. But when compiling this sample project, there was an error. I’m so sad. :frowning: :frowning: :frowning: :frowning: :frowning: :frowning: :frowning: Why do you want to do this to me? I just want to try to compile audacity project. There are always errors, and I can’t find relevant solutions on the Internet. My mind has broken down.

What was the error?
Have you tried other sample projects? If I recall correctly, I tested with the calendar sample.

I’m sorry that I can’t open the screenshot of the widgets project in time to show you the compilation error, because I’m still busy with other projects. I have to finish another project before 7:00 p.m. Beijing time. Later, if I have time, I will upload the whole process of compiling widgets and attach the compilation errors. Friend, thank you very much for your timely reply and check. If there is no reply from you, I think I will be depressed.

There is one obvious problem in that build.txt file

DO set WXWIN to the appropriate directory where you installed wxWidgets.
To do that, open a cmd.exe window, and type:
set WXWIN=C:\wxWidgets-3.1.1 > WRONG!

Setting the environment variable like this means it will only persist for the shell you are currently in. This variable should be set permanently via
advanced system settings ( run SystemPropertiesAdvanced.exe). Under the advanced tab select the environment variables button and create new variables for wxWidgets and if required for ASIO too.

Thanks roadsterUK. That would explain why I had so much difficulty making the environment variable stick.

Hi, friend, do you remember me. Now that I’ve compiled audacity, I’ve written a tutorial to record the mistakes I made when I compiled it. But at present, I have a new problem: I want to change the icon when the software starts to a cool image, but I don’t know where to modify it. I want to consult you.

The splash image is:
/images/AudacityLogoWithName.xpm

Note 1: After modifying the image, Audacity must be rebuilt.

Note 2: If this is not only for personal use, please ensure that you fully comply with Audacity’s license and trademark (Details may be found in the “About” section of the Audacity website:

https://www.audacityteam.org/about/license/
https://www.audacityteam.org/about/citations-screenshots-and-permissions/

Thank you for your reply. Yes, it’s just for personal use.

Hi,

I’m trying to compile Audacity v2.3.3 on Windows 10 using Visual Studio 2019 Community.

I have downloaded the following SDKs :

  • Steinberg ASIO : version 2.3.3_2019-06-14
  • wxWidget : v3.1.3

What I did before building Audacity:

  • Compile wxWidget (DLL Debug, Audacity is targetted to Debug)
  • Set the environment variables
  • Inside wxWidget, copy all the *.lib files from vc_lib folder to the vc_dll folder (I was having missing files errors otherwise)

My problem : I can’t build Audacity. At this stage, I can build every projects except mod-null, mod-nyq-bench, mod-script-pipe and Audacity.

I get several hundreds errors but it’s pretty much summarized in the mod-null build. I think I can manage to fix them all as soon as these 5 errors will be fixed (excuse my french) :

Gravité	Code	Description	Projet	Fichier	Ligne	État de la suppression	État de la suppression
Erreur	LNK2019	symbole externe non résolu "__declspec(dllimport) public: __thiscall wxString::wxString(void)" (__imp_??0wxString@@QAE@XZ) référencé dans la fonction "public: __thiscall Identifier::Identifier(void)" (??0Identifier@@QAE@XZ)	mod-null	D:\Downloads\Audacity\audacity-Audacity-2.3.3_\win\Projects\mod-null\ModNullCallback.obj	1		
Erreur	LNK2019	symbole externe non résolu "__declspec(dllimport) public: __thiscall wxString::wxString(wchar_t const *)" (__imp_??0wxString@@QAE@PB_W@Z) référencé dans la fonction "public: __thiscall Identifier::Identifier(wchar_t const *)" (??0Identifier@@QAE@PB_W@Z)	mod-null	D:\Downloads\Audacity\audacity-Audacity-2.3.3_\win\Projects\mod-null\ModNullCallback.obj	1		
Erreur	LNK2019	symbole externe non résolu "__declspec(dllimport) public: __thiscall wxString::~wxString(void)" (__imp_??1wxString@@QAE@XZ) référencé dans la fonction "public: __thiscall Identifier::~Identifier(void)" (??1Identifier@@QAE@XZ)	mod-null	D:\Downloads\Audacity\audacity-Audacity-2.3.3_\win\Projects\mod-null\ModNullCallback.obj	1		
Erreur	LNK2019	symbole externe non résolu "__declspec(dllimport) public: class wxMenu * __thiscall wxMenuBarBase::GetMenu(unsigned int)const " (__imp_?GetMenu@wxMenuBarBase@@QBEPAVwxMenu@@I@Z) référencé dans la fonction _ModuleDispatch	mod-null	D:\Downloads\Audacity\audacity-Audacity-2.3.3_\win\Projects\mod-null\ModNullCallback.obj	1		
Erreur	LNK1120	4 externes non résolus	mod-null	D:\Downloads\Audacity\audacity-Audacity-2.3.3_\win\Debug\modules\mod-null.dll	1

This translates roughly to :

LNK2019 external symbol not recognized "__declspec(dllimport) public: __thiscall wxString::wxString(void)" (__imp_??0wxString@@QAE@XZ) référencé dans la fonction "public: __thiscall Identifier::Identifier(void)" (??0Identifier@@QAE@XZ)	mod-null
etc

I’m a coder but not a C++ coder and I don’t have a clue of what to do.

Your help will be pretty much appreciated !

Thanks !

Under audacity / win folder, there is a build.txt file. You should strictly follow the above process to compile.
1.png
Look at the attachment I uploaded, use git to clone the wxWidgets project, and be sure to have the parameter – recurse submodules. I’ve tried to download the project from the wxWidgets website,but an error will be reported at compile time.Then you continue to follow the steps described in build.txt to compile the wxWidgets project. When you have finished compiling, remember to run the samples \ minimal sample project, which is to determine whether you have successfully compiled wxWidgets. If the samples \ minimal sample project can run perfectly without any errors, congratulations. It will succeed when you compile audacity again. If you have any problems in later compilation, please reply to me. I will try my best to help you, because I know the feeling of unsuccessful compilation many times. I hope you can succeed next time. :smiley:

Just to add: After rebuilding wxWidgets, do a complete build of Audacity from scratch - don’t just try to complete a previous build, trash any previous Audacity build and start over.

You should not have needed to copy any dlls for wxwidgets so I suspect that your WXWIN environment variable is not correctly set. Open up a command window, type set and check the variables before looking for more obscure problems.