Undefined reference to CoInitialize@4 and CoUninitialize@0

3k Views Asked by At

I've built and included the RtAudio library in a project, but when I try to build the project itself, I get errors:

RtAudio.cpp:-1: error: undefined reference to `CoInitialize@4'
RtAudio.cpp:-1: error: undefined reference to `CoUninitialize@0'
:-1: error: D:/Qt/Qt5.3.2/Tools/QtCreator/bin/teslib/../../../../../../lib/rtaudio-4.1.1//librtaudio.a(RtAudio.o): bad reloc address 0x17 in section `.text.unlikely'
collect2.exe:-1: error: error: ld returned 1 exit status

The third error message looks suspicious, what does this mean?

bad reloc address 0x17 in section `.text.unlikely'

I wasn't able to build the library with the MinGW bundled with Qt, so I built it with the same major version (4.8), is it possible that the library is incompatible with Qt due to being built with a different minor version of GCC?

1

There are 1 best solutions below

9
On

CoInitialize and CoUnitialize are defined in the library Ole32.lib. Make sure the library is included in the linker library list.