c++windowsaudioasiosteinberg-asio

How to compile Steinberg ASIO SDK on Window?


I want to compile a simple program using ASIO SDK, however there is a strange error that I cannot fix.

#include "asio.h"

int main(void)
{
    ASIODriverInfo info {};

    ASIOInit(&info);

    return 0;
}

In this portion of code I call the ASIOInit(ASIODriverInfo *info) function and i cause this error:

asiosdk/common/asiodrvr.cpp:16:2: error: #error do not use this
   16 | #error do not use this
      |  ^~~~~

and when I check in the asiodrvr.cpp file, I found this code:

#if WINDOWS
#error do not use this
AsioDriver::AsioDriver (LPUNKNOWN pUnk, HRESULT *phr) : CUnknown("My AsioDriver", pUnk, phr)
{
}

If I erase it it works but i'm not supposed to modify the SDK, so do you know what is the correct way to avoid this error ?

My configuration is as follows:
OS: Window 11
compiler: g++ (MinGW64)
compile with: handmade makefile
c++ version: 23
compiler flags: -Wall -Wextra -Wpedantic

I try to remove the error, but it's not correct for the portability I guess, I refer to the documentation(PDF) in th SDK file, unsuccessful.


Solution

  • You should not be including asiodrvr.cpp in your build. At least, I think so. I only build with the following files:

    asio.cpp
    asiodrivers.cpp
    asiolist.cpp
    

    Try with those, see how you go. ASIO started out with the intention of being cross-platform, but, AFAIK, is now Windows only.