Compiling libogg and libvorbis on Windows for Dummies
I don’t have much experience with Visual Studio (I’m a linux/gcc person) so I wasted a few hours messing around to get this to work. Hopefully this’ll save someone some time.
Procedure
libogg
-
Download Visual Studio 2019 Community installer from https://visualstudio.microsoft.com/downloads/
-
Install Visual Studio 2019 Community, selecting the “Desktop Development with C++ option”
-
Download
libogg
andlibvorbis
from https://xiph.org/downloads/, extracting to the same folder.libogg-x.y.z
andlibvorbis-x.y.z
folders should be side-by-side. -
Open
libogg-x.y.z/win32/VS2015/libogg.sln
. if there is an error saying that the project was not loaded, close Visual Studio and re-open. -
If prompted, accept the upgrade to Platform Toolset v142 and Windows SDK 10.0 (latest installed version). If no prompt appears, you can retarget to those options by right-clicking on
libogg
in theSolution Explorer
pane, or by using the Project menu:Project
>Properties
>All Configurations, All Platforms
>Windows SDK Version & Platform Toolset
. -
Select Configuration and Platform in the toolbar up top. Select
Debug
/Release
if you need a.lib
to link against statically. SelectDebugDLL
/ReleaseDLL
if you need a.dll
to link against dynamically.Win32
if you need 32-bit, otherwisex64
. -
Build!
libvorbis
You’ll need libogg
to compile libvorbis
, so make sure all the steps above are completed.
-
Edit
libvorbis-x.y.z/win32/VS2010/libogg.props
, check that theLIBOGG_VERSION
is the same as what you’ve downloaded. -
Open
libvorbis-x.y.z/win32/VS2010/vorbis_{dynamic,static}.sln
. If you need a.lib
, choosevorbis_static.sln
. If you need a.dll
, choosevorbis_dynamic.sln
. -
Similar to
libogg
, accept the upgrade or retarget. -
Select Configuration and Platform. Since the solution files are different this time, there’s only two configurations:
Debug
/Release
. -
Build! If there’s an error when building that says
cannot open file libogg.lib
, you’ll need to compile the staticlibogg
first - make surelibogg
is compiled for the sameDebug
/Release
and same platform that you want to compilelibvorbis
for.