Reputation: 31
I need to use port audio in QtCreator. But i can't make the link work.
I have a very simple main:
#include "portaudio.h"
#include <iostream>
int main(int, char *[])
{
std::cout << Pa_GetErrorText(0) << std::endl;
return 0;
}
Il put this snippet in a folder with portaudio.lib. In Visual Studio 2012, it compile and excute well (after adding the include path and the library).
In QtCreator, i try to add to the .pro:
LIBS += -L$$PWD -lportaudio
or:
LIBS += $$PWD/portaudio.lib
So, i'm a litle lost. I'm not very familiar with windows build environement.
I add the compile output.
link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:CONSOLE "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST /MANIFESTFILE:debug\test_portaudio.exe.embed.manifest /OUT:debug\test_portaudio.exe
@C:\Users\victor\AppData\Local\Temp\test_portaudio.exe.7044.16.jom
main.obj : error LNK2019: external symbol Pa_GetErrorText referenced in function main
debug\test_portaudio.exe : fatal error LNK1120: 1 externes non résolus
jom: C:\Users\victor\Documents\build-test_portaudio-Desktop_Qt_5_2_0_MSVC2012_64bit-Debug\Makefile.Debug [debug\test_portaudio.exe] Error 1120
jom: C:\Users\victor\Documents\build-test_portaudio-Desktop_Qt_5_2_0_MSVC2012_64bit-Debug\Makefile [debug] Error 2
09:05:25: The process "C:\Qt\Tools\QtCreator\bin\jom.exe" exited with code 2.
Error while building/deploying project test_portaudio (kit: Desktop Qt 5.2.0 MSVC2012 64bit)
When executing step 'Make'
Thanks for your help, Vhb
EDIT: Here is the .pro file:
QT += core
QT -= gui
TARGET = test_portaudio
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
INCLUDEPATH += $$PWD/../portaudio/include
LIBS += -L$$PWD -lportaudio
SOURCES += main.cpp
The manifest file:
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level='asInvoker' uiAccess='false' />
</requestedPrivileges>
</security>
</trustInfo>
<dependency>
<dependentAssembly>
<assemblyIdentity type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*' />
</dependentAssembly>
</dependency>
</assembly>
I'm working on qt 5.2.0 with qtCreator 3.0 and Visual Studio 2012.
Upvotes: 2
Views: 1779
Reputation: 53173
Your linker command does not seem to have realized the changes:
link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:CONSOLE "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='' processorArchitecture=''" /MANIFEST /MANIFESTFILE:debug\test_portaudio.exe.embed.manifest /OUT:debug\test_portaudio.exe
As you can see, there is no reference in there to the portaudio library. It is not surprising that you are getting an undefined reference, then.
You probably forgot to rerun qmake by using the execute qmake option explicitly. Once that is done, it will work.
It is hard to tell more without providing more context, but you could also double check this operation from the command line by using qmake
. It works here.
Upvotes: 1