Play a sound with Qt5 and Windows 8 + minWG
-
Good evening everbody:
I'm really new in Qt, and I like it so much, there are many reasons why. In fact I've built a simple app type widget. This app consists in a game in which system randomly choose a number in order to be guessed by a player. Everything goes fine. But I need add some sound (wav files) to my app, according the situation (You all know far more than me). For short this is my line of code to add some sound:
QString sonido="audio/newGame.wav";
QSound player(sonido);
player.play();And this is the message error i get:
E:\QtFilesPros\wtnBoy\wingame.cpp:77: error: undefined reference to `_imp___ZN6QSoundC1ERK7QStringP7QObject'
May I get your help? Thanks a million for your support. What can I do to solve this problem?
-
"...:)""
-
welcome to devnet
The error message seem to stem from a missing object file or library. You have either not added the cpp-file to your project and therefore, it is not compiled or in case of a lib, the reference to the lib is missing.
Alternatively, it may come from mixed compile models (e.g. one of the modules has been compiled with a different compiler or memory model).
This happens when you download a library compiled with a different compiler or memory model and mixed things. Modules compiled with different compilers msvc (2005, 2008, 2010, 2012) cannot be mixed. Also at least the object files MinGW 4.6 and 4.7 are not compatible. The same certainly for mixing 32 and 64 bit for all compilers. -
Thanks a lot for your answer.
Couldyou advice me how to solve this?In fact, I had installed, previously, qt creator 5.0 with vs 2010, but it caused me some problems (At first, i got a message of a missing compiler, this is why I decided to change). As I told before I'm new, so given that the first version didn't work properly, I decided to install minWG. And it worked with this version.
There's no manual to install Qt5 with vs2010. Which are the features needed to install it in Windows 8?
Thanks for your support.
-
-
@_imp___something@
...is usually related to DLL imports.
Are you sure you are linking against all import libraries for all required DLL's?
Should be in QtGui.DLL, I think.