[Solved] QSound and error 2019
-
I am using QT5
-
For "Qt5 there is the same. ":http://qt-project.org/doc/qt-5.0/qtmultimedia/qtmultimedia-index.html
@
QT += multimedia
@
Do you have this line in your .pro file? -
Thanks for the answer, unfortunately I tried it but I still have the same issue.
-
You need to post the .pro and the linker output then.
-
ok. here is the .pro:
@#-------------------------------------------------Project created by QtCreator 2013-01-20T19:04:47
#-------------------------------------------------
QT += core gui
QT += widgets
QT += multimediagreaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = Melody_gen
TEMPLATE = appSOURCES += main.cpp
mainwindow.cppHEADERS += mainwindow.h
FORMS += mainwindow.ui
@
and here is the output:\Users\leo\AppData\Local\Temp\Melody_gen.exe.1108.1841.jom
main.obj : error LNK2019: symbole externe non résolu "__declspec(dllimport) public: static void __cdecl QSound::play(class QString const &)" (_imp?play@QSound@@SAXABVQString@@@Z) référencé dans la fonction _main
release\Melody_gen.exe : fatal error LNK1120: 1 externes non résolus
jom: C:\Users\leo\Documents\c++\Melody_gen-build-Desktop_Qt_5_0_0_MSVC2010_32bit_SDK-Release\Makefile.Release [release\Melody_gen.exe] Error 1120
jom: C:\Users\leo\Documents\c++\Melody_gen-build-Desktop_Qt_5_0_0_MSVC2010_32bit_SDK-Release\Makefile [release] Error 2
21:36:23: The process "C:\Qt\Qt5.0.0\Tools\QtCreator\bin\jom.exe" exited with code 2.
Error while building/deploying project Melody_gen (kit: Desktop Qt 5.0.0 MSVC2010 32bit (SDK))
When executing step 'Make' -
Try giving the QSound static call the full path of the .wav file, file system and all..
-
you mean trying this?
@ QSound::play("C:/Users/leo/documents/c++/melody-gen/pan.wav");@
Because When I try this I still get the same error... -
[quote author="patouf35" date="1358908620"]you mean trying this?
@ QSound::play("C:/Users/leo/documents/c++/melody-gen/pan.wav");@
Because When I try this I still get the same error...[/quote]
IMHO the path is not the problem. You have a linking problem well before you can start the application.
The linker does not find the function QSound::play. My rudimentary French is good enough to catch this.
Since the other Qt stuff is not a problem, it must have something to do with the required libs for multimedia. Unfortunately, I have no experience in multimedia nor Qt 5. I am a bit on a loss here.Did you ever rerun qmake in creator?
When you add something in a .pro file, this file has to be converted to a makefile which will be used by jom in your case. Most likely the additions to your pro-file have not been transported to the makefile.
Under "Edit" you should have the "projects" window on the left. Right mouse click on the project name you should find in the pop-up on 3rd position something like "Run qmake". Do this and a rebuild to be sure. -
Thanks a lot! When I ran qmake it worked. Thanks again! :)
-
You are welcome ;-)