Unsolved Compile Error with QT Creator 5.9
-
Hi All,
I have a problem with my project when i use QT creator 5.9. The problem error is:
C:\Program Files (x86)\Windows Kits\8.1\include\um\sapi.h:12407: error: C2440: 'default argument': cannot convert from 'const wchar_t [1]' to 'BSTR'
I had investigated on this issue however, i could not find out any solution to resolve it. I have tried to use :
win32: QMAKE_CXXFLAGS_RELEASE -= -Zc:strictStrings
win32: QMAKE_CFLAGS_RELEASE -= -Zc:strictStrings
win32: QMAKE_CFLAGS -= -Zc:strictStrings
win32: QMAKE_CXXFLAGS -= -Zc:strictStringsFrom this link: https://stackoverflow.com/questions/37204166/error-c2440-default-argument-cannot-convert-from-const-wchar-t-1-to-bst
But it does not help.
Can somebody help me on this?
Thanks. -
Hi,
Qt Creator is innocent in that matter, that's the compiler you are using that is problematic.
Which version of Visual Studio are you using 2015 or 2017 ?
Did you re-run qmake after adding these flags ?
-
I am using Visual Studio 2015. I just tried to run QMake again. I don't get error message any more. However, i could not run my application. The build status is in RED.
I got this complier error message:
The kit Desktop Qt 5.9.0 MSVC2015 64bit has configuration issues which might be the root cause for this problem.
When executing step "Make"Should i use Visual Studio 2017?
-
i am still having this error. Are there any way to update my compiler or we should use new one (2017)?
-
@William.Tran Maybe you should use a newer Windows SDK: https://developer.microsoft.com/de-de/windows/downloads/windows-10-sdk ?
-
It looks like the error from my code. I have a class which support speech text.
void speechcontext::startSpeaking(){
qDebug("start speaking thread"); pVoice = NULL; isSpeaking = true; HRESULT hr = CoCreateInstance(CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice, (void **)&pVoice); if( SUCCEEDED( hr ) ) { LPCWSTR text = (const wchar_t*) currentTextToSpeak.utf16(); if(currentVoiceToken != NULL){ pVoice->SetVoice(currentVoiceToken); } hr = pVoice->Speak(text, 0, NULL); HANDLE hWait = pVoice->SpeakCompleteEvent(); HRESULT rs = WaitAndPumpMessagesWithTimeout(hWait, INFINITE); if(rs == S_OK){ qDebug("speaking completed"); } pVoice->Release(); pVoice = NULL; }
}
Something like that, and i have used:
#include <sapi.h>
#include <sphelper.h>
#include <conio.h>
#include <iostream>
#include <string>If i remove <sphelper.h> and its components. (some objects used in handle class). I can build my app success. So i think the speech text class is not compatible anymore. I should you QtSpeech in 5.9?
-
That would be a good idea yes.