2

Is it possible to detect build fail and emit a custom sound signal (e.g., via batch file) in QtCreator?

Currently I have a post-build step in my project settings, where I start a .bat file with sound. When my projects builds successfully, I hear this, everything is ok. When build fails, the post-build step will not be reached, so there is no signal.

So is it possible to make a sound signal for build failure, and how? Or there is no way to do it?

cornhedgehog
  • 85
  • 1
  • 5

1 Answers1

2

Create .bat file and save it somewhere. Change c:\Qt\Tools\QtCreator\bin\jom.exe to correct path, if you use nmake or mingw-make change it to corresponding pathname

make.bat:

c:\Qt\Tools\QtCreator\bin\jom.exe
if errorlevel 1 (
   rundll32 user32.dll,MessageBeep
)

In QtCreator go to Projects -> Build & Run and in the Build Steps add Custom Process Step. In Command field add path to created make.bat file:

Command: C:\<path to your make.bat file>

Now deactivate original Make step in Build Steps and build your project. If return value of process would be greater than 0 you will hier the sound.

Xplatforms
  • 2,102
  • 17
  • 26