Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7663059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:57:36+00:00 2026-05-31T13:57:36+00:00

I am trying to use ASIO (Audio Stream Input/Output). I downloaded SDK, but because

  • 0

I am trying to use ASIO (Audio Stream Input/Output). I downloaded SDK, but because this SDK has no library, only headers and source files, I had to compile it into a library. Moreover, it was written so that it uses some of the features from MSVC (specifically some macro definitions – _WIN64 and WINVER). I cannot use MSVC for licensing reasons. So I am using Eclipse CDT with MinGW, told preprocessor to set these macros (for Windows 7 x64) and happily compiled a library.

Now when I want to use that library, I keep getting Undefined reference. Can you please tell me what I am getting wrong?

Hello world file (load ASIO driver and print its info):

#include <stdio.h>
#include <stdlib.h>
#include <asio.h>

int main(int argc, char **argv) {
    ASIODriverInfo driverInfo;
    ASIOInit(&driverInfo);

    printf("ASIO version: %ld\n", driverInfo.asioVersion);
    printf("Driver name: %s\n", driverInfo.name);
    printf("Driver version: %ld\n", driverInfo.driverVersion);
    printf("Error message: %s\n", driverInfo.errorMessage);

    return (EXIT_SUCCESS);
}

Verbose output from gcc:

> gcc -v -Lc:/ASIOSDK2/lib/Win7/libasio.a -o ASIOHello.exe src\main.o
> Using built-in specs. COLLECT_GCC=gcc
> COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.6.1/lto-wrapper.exe Target: mingw32 Configured with: ../gcc-4.6.1/configure
> --enable-languages=c,c++,fortran,objc,obj-c++ --disable-sjlj-exceptions --with-dwarf2 --enable-shared --enable-libgomp --disable-win32-registry --enable-libstdcxx-debug --enable-version-specific-runtime-libs --build=mingw32 --prefix=/mingw Thread model: win32 gcc version 4.6.1 (GCC) 
> COMPILER_PATH=c:/mingw/bin/../libexec/gcc/mingw32/4.6.1/;c:/mingw/bin/../libexec/gcc/;c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../../mingw32/bin/
> LIBRARY_PATH=c:/mingw/bin/../lib/gcc/mingw32/4.6.1/;c:/mingw/bin/../lib/gcc/;c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../../mingw32/lib/;c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../;/mingw/lib/
> COLLECT_GCC_OPTIONS='-v' '-Lc:/ASIOSDK2/lib/Win7/libasio.a' '-o'
> 'ASIOHello.exe' '-mtune=i386' '-march=i386' 
> c:/mingw/bin/../libexec/gcc/mingw32/4.6.1/collect2.exe -Bdynamic -o
> ASIOHello.exe c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../crt2.o
> c:/mingw/bin/../lib/gcc/mingw32/4.6.1/crtbegin.o
> -Lc:/ASIOSDK2/lib/Win7/libasio.a -Lc:/mingw/bin/../lib/gcc/mingw32/4.6.1 -Lc:/mingw/bin/../lib/gcc -Lc:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../../mingw32/lib -Lc:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../.. -L/mingw/lib src\main.o -lmingw32 -lgcc_eh -lgcc -lmoldname -lmingwex -lmsvcrt
> -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc_eh -lgcc -lmoldname -lmingwex -lmsvcrt c:/mingw/bin/../lib/gcc/mingw32/4.6.1/crtend.o src\main.o: In function
> `main': <my workspace path>\ASIOHello\Debug/../src/main.c:7: undefined
> reference to `ASIOInit' collect2: ld returned 1 exit status Build
> error occurred, build is stopped Time consumed: 454  ms.

And output from nm for the library (only the relevant object):

> asio.o:
> 00000000 b .bss
> 00000000 d .data
> 00000000 N .debug_abbrev
> 00000000 N .debug_aranges
> 00000000 N .debug_info
> 00000000 N .debug_line
> 00000000 N .debug_loc
> 00000000 N .debug_str
> 00000000 r .eh_frame
> 00000000 r .rdata
> 00000000 t .text
> 0000055a T __Z10ASIOFuturelPv
> 0000018c T __Z15ASIOGetChannelsPlS_
> 00000596 T __Z15ASIOOutputReadyv
> 0000052c T __Z16ASIOControlPanelv
> 000001db T __Z16ASIOGetLatenciesPlS_
> 0000029b T __Z17ASIOCanSampleRated
> 0000047b T __Z17ASIOCreateBuffersP14ASIOBufferInfollP13ASIOCallbacks
> 0000022a T __Z17ASIOGetBufferSizePlS_S_S_
> 000002e9 T __Z17ASIOGetSampleRatePd
> 0000031e T __Z17ASIOSetSampleRated
> 000004fe T __Z18ASIODisposeBuffersv
> 00000422 T __Z18ASIOGetChannelInfoP15ASIOChannelInfo
> 000003b1 T __Z18ASIOSetClockSourcel
> 0000036c T __Z19ASIOGetClockSourcesP15ASIOClockSourcePl
> 000003e6 T __Z21ASIOGetSamplePositionP11ASIOSamplesP13ASIOTimeStamp
> 00000103 T __Z8ASIOExitv
> 00000000 T __Z8ASIOInitP14ASIODriverInfo
> 0000015e T __Z8ASIOStopv
> 00000130 T __Z9ASIOStartv
>          U __ZN11AsioDrivers19removeCurrentDriverEv
>          U _asioDrivers
> 00000000 B _theAsioDriver
> 

EDIT:

Okay, now I managed to compile the library so it is accesible by C code (I added

extern “C”

in front of every function declaration. Now the nm output looks like this:

> 0000036c T _ASIOGetClockSources
> 000001db T _ASIOGetLatencies
> 000003e6 T _ASIOGetSamplePosition
> 000002e9 T _ASIOGetSampleRate
> 00000000 T _ASIOInit
> 00000596 T _ASIOOutputReady
> 000003b1 T _ASIOSetClockSource
> 0000031e T _ASIOSetSampleRate
> 00000130 T _ASIOStart
> 0000015e T _ASIOStop

which is looking pretty good. I still have some name mangling tho, it still complains about undefined references.

gcc -v -Lc:/ASIOSDK2/lib/Win7 -lasio -o ASIOHello.exe src\main.o

What am I still missing here?

EDIT 2:
I finally made things work. It seems the error was caused by some leftover settings caching. Deleting the project and setting everything up again solved the problem. But thanks @John Zwick for the tip with library compilation, I would be stuck on that for a long time.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T13:57:38+00:00Added an answer on May 31, 2026 at 1:57 pm

    I finally made things work. It seems the error was caused by some leftover settings caching. Deleting the project and setting everything up again solved the problem. But thanks @John Zwick for the tip with library compilation, I would be stuck on that for a long time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am relatively new to CMake, and I'm trying use the boost asio library
I am trying to use BOOST ASIO library asynchronous sockets. My platform is Linux.
Trying to use a guid as a resource id in a rest url but
Trying to use this method (gist of which is use self.method_name in the FunnyHelper
Trying to use this code to connect the AD PrincipalContext context = new PrincipalContext(ContextType.Domain,
I am trying use filehelpers class builder but I am kinda confused on what
I am trying use MySql and Entity Framework, using Connector/Net 6.1 with this as
I am trying to adapt one of the boost::asio examples to use c++11 /
I am trying use std::copy to copy from two different iterator. But during course
i'm trying use webview to load a image from sdcard i use this path

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.