Qt application stack overflow exception - qt

I want to call QNetworkReply::readAll as shown in Foo() such that once it completes, another time it should be called.
QString Foo (QString& requestUrl)
{
QNetworkReply *pReply = NetManager::getManager()->get(requestUrl,NULL,NULL);
QEventLoop loop;
QObject::connect(pReply,SIGNAL(finished()),&loop,SLOT(quit()));
loop.exec();
return pReply->readAll();
}
I want this because my Qt Gui application crashed with 0xC00000FD: Stack overflow exception. and in callstack, I got repeated calling of functions as shown in below callstack.
I don't understand that despite of using QEventLoop to make call to readAll() synchronous, how recursion is possible.
My Gui application is used by user to click and initiate readAll().
Is there a way to prevent the crash?
MyUtility.dll!Class::Function(l) Line abc C++
Qt5Core.dll!0000000052b0991c() Unknown
Qt5Widgets.dll!0000000056ff9d9a() Unknown
Qt5Widgets.dll!0000000056ffb4ff() Unknown
Qt5Widgets.dll!00000000570e8c57() Unknown
Qt5Core.dll!0000000052aeb905() Unknown
Qt5Widgets.dll!0000000056fd4ff2() Unknown
Qt5Widgets.dll!0000000056fd35a6() Unknown
Qt5Core.dll!0000000052ae9aea() Unknown
Qt5Widgets.dll!0000000057021e95() Unknown
Qt5Widgets.dll!00000000570204ee() Unknown
Qt5Widgets.dll!0000000056fd5006() Unknown
Qt5Widgets.dll!0000000056fd4623() Unknown
Qt5Core.dll!0000000052ae9aea() Unknown
Qt5Gui.dll!000007fededd3c52() Unknown
Qt5Gui.dll!000007fededd5f67() Unknown
Qt5Gui.dll!000007fededc379e() Unknown
Qt5Core.dll!0000000052b2e6c5() Unknown
user32.dll!UserCallWinProcCheckWow() Unknown
user32.dll!DispatchMessageWorker() Unknown
Qt5Core.dll!0000000052b2ddfc() Unknown
qwindows.dll!000007fedd1df491() Unknown
Qt5Core.dll!0000000052ae6c61() Unknown
MyUtility.dll!Class::Function(l) Line abc C++
Qt5Core.dll!0000000052b0991c() Unknown
Qt5Widgets.dll!0000000056ff9d9a() Unknown
Qt5Widgets.dll!0000000056ffb4ff() Unknown
Qt5Widgets.dll!00000000570e8c57() Unknown
Qt5Core.dll!0000000052aeb905() Unknown
Qt5Widgets.dll!0000000056fd4ff2() Unknown
Qt5Widgets.dll!0000000056fd35a6() Unknown
Qt5Core.dll!0000000052ae9aea() Unknown
Qt5Widgets.dll!0000000057021e95() Unknown
Qt5Widgets.dll!00000000570204ee() Unknown
Qt5Widgets.dll!0000000056fd5006() Unknown
Qt5Widgets.dll!0000000056fd4623() Unknown
Qt5Core.dll!0000000052ae9aea() Unknown
Qt5Gui.dll!000007fededd3c52() Unknown
Qt5Gui.dll!000007fededd5f67() Unknown
Qt5Gui.dll!000007fededc379e() Unknown
Qt5Core.dll!0000000052b2e6c5() Unknown
user32.dll!UserCallWinProcCheckWow() Unknown
user32.dll!DispatchMessageWorker() Unknown
Qt5Core.dll!0000000052b2ddfc() Unknown
qwindows.dll!000007fedd1df491() Unknown
Qt5Core.dll!0000000052ae6c61() Unknown
Qt5Core.dll!0000000052ae8d39() Unknown
MyUtility.exe!main(int argc, char * * argv) Line abc C++
MyUtility.exe!WinMain() C++

Related

How to solve executing problem of MPICH: error code (10049)

I'm new to MPICH2 I trying to execute a little program. The program builds without errors but when I try to run it shows the error I've attached below. Could you please help me to solve this.
> [01:17268]..ERROR:Error while connecting to host, The requested address is not valid in its context. (10049)
[01:17268]..ERROR:Connect on sock (host=localhost, port=0) failed, exhaused all end points
SMPDU_Sock_post_connect failed.
[2] PMI_ConnectToHost failed: unable to post a connect to localhost:0, error: Undefined dynamic error code
uPMI_ConnectToHost returning PMI_FAIL
[2] PMI_Init failed.
Fatal error in MPI_Init: Other MPI error, error stack:
MPIR_Init_thread(377): Initialization failed
MPID_Init(90)........: channel initialization failed
MPID_Init(357).......: PMI_Init returned -1
[01:10548]..ERROR:Error while connecting to host, The requested address is not valid in its context. (10049)
[01:10548]..ERROR:Connect on sock (host=localhost, port=0) failed, exhaused all end points
SMPDU_Sock_post_connect failed.
[1] PMI_ConnectToHost failed: unable to post a connect to localhost:0, error: Undefined dynamic error code
uPMI_ConnectToHost returning PMI_FAIL
[1] PMI_Init failed.
Fatal error in MPI_Init: Other MPI error, error stack:
MPIR_Init_thread(377): Initialization failed
MPID_Init(90)........: channel initialization failed
MPID_Init(357).......: PMI_Init returned -1
[01:11576]..ERROR:Error while connecting to host, The requested address is not valid in its context. (10049)
[01:11576]..ERROR:Connect on sock (host=localhost, port=0) failed, exhaused all end points
SMPDU_Sock_post_connect failed.
[0] PMI_ConnectToHost failed: unable to post a connect to localhost:0, error: Undefined dynamic error code
uPMI_ConnectToHost returning PMI_FAIL
[0] PMI_Init failed.
Fatal error in MPI_Init: Other MPI error, error stack:
MPIR_Init_thread(377): Initialization failed
MPID_Init(90)........: channel initialization failed
MPID_Init(357).......: PMI_Init returned -1
#include <mpi.h>
#include <stdio.h>
int main() {
int np;
int pid;
MPI_Init(NULL,NULL);
MPI_Comm_size(MPI_COMM_WORLD,&np);
MPI_Comm_rank(MPI_COMM_WORLD, &pid);
printf("Hi parallel...\n");
MPI_Finalize();
return 0;
}

Error when building nginx docker

I am trying to build a docker from a fork and I am getting the following error when performing docker build ./:
cc1: all warnings being treated as errors
make[1]: *** [objs/src/event/ngx_event_openssl.o] Error 1
objs/Makefile:748: recipe for target 'objs/src/event/ngx_event_openssl.o' failed
make[1]: Leaving directory '/tmp/nginx/nginx-1.8.0'
make: *** [install] Error 2
On install we run
apt-get -y install libpcre3-dev zlib1g-dev libssl-dev openssl build-essential wget
I can't find this error on google. The full error for reference as I can't find out the exact error reference I need to research:
src/event/ngx_event_openssl.c: In function 'ngx_ssl_init':
src/event/ngx_event_openssl.c:112:5: error: 'OPENSSL_config' is deprecated [-Werror=deprecated-declarations]
OPENSSL_config(NULL);
^~~~~~~~~~~~~~
In file included from /usr/include/openssl/ct.h:13:0,
from /usr/include/openssl/ssl.h:61,
from src/event/ngx_event_openssl.h:15,
from src/core/ngx_core.h:80,
from src/event/ngx_event_openssl.c:9:
/usr/include/openssl/conf.h:92:1: note: declared here
DEPRECATEDIN_1_1_0(void OPENSSL_config(const char *config_name))
^
src/event/ngx_event_openssl.c: In function 'ngx_ssl_rsa512_key_callback':
src/event/ngx_event_openssl.c:753:9: error: 'RSA_generate_key' is deprecated [-Werror=deprecated-declarations]
key = RSA_generate_key(512, RSA_F4, NULL, NULL);
^~~
In file included from /usr/include/openssl/rsa.h:13:0,
from /usr/include/openssl/x509.h:31,
from /usr/include/openssl/ssl.h:50,
from src/event/ngx_event_openssl.h:15,
from src/core/ngx_core.h:80,
from src/event/ngx_event_openssl.c:9:
/usr/include/openssl/rsa.h:193:1: note: declared here
DEPRECATEDIN_0_9_8(RSA *RSA_generate_key(int bits, unsigned long e, void
^
src/event/ngx_event_openssl.c: In function 'ngx_ssl_dhparam':
src/event/ngx_event_openssl.c:943:11: error: dereferencing pointer to incomplete type 'DH {aka struct dh_st}'
dh->p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL);
^~
src/event/ngx_event_openssl.c: In function 'ngx_ssl_handshake':
src/event/ngx_event_openssl.c:1164:31: error: dereferencing pointer to incomplete type 'SSL {aka struct ssl_st}'
if (c->ssl->connection->s3) {
^~
src/event/ngx_event_openssl.c: In function 'ngx_ssl_connection_error':
src/event/ngx_event_openssl.c:1913:21: error: 'SSL_R_NO_CIPHERS_PASSED' undeclared (first use in this function)
|| n == SSL_R_NO_CIPHERS_PASSED /* 182 */
^~~~~~~~~~~~~~~~~~~~~~~
src/event/ngx_event_openssl.c:1913:21: note: each undeclared identifier is reported only once for each function it appears in
src/event/ngx_event_openssl.c: In function 'ngx_ssl_session_cache':
src/event/ngx_event_openssl.c:2107:43: error: passing argument 2 of 'SSL_CTX_sess_set_get_cb' from incompatible pointer type [-Werror=incompatible-pointer-types]
SSL_CTX_sess_set_get_cb(ssl->ctx, ngx_ssl_get_cached_session);
^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/event/ngx_event_openssl.h:15:0,
from src/core/ngx_core.h:80,
from src/event/ngx_event_openssl.c:9:
/usr/include/openssl/ssl.h:637:6: note: expected 'SSL_SESSION * (*)(struct ssl_st *, const unsigned char *, int, int *) {aka struct ssl_session_st * (*)(struct ssl_st *, const unsigned char *, int, int *)}' but argument is of type 'SSL_SESSION * (*)(SSL *, u_char *, int, int *) {aka struct ssl_session_st * (*)(struct ssl_st *, unsigned char *, int, int *)}'
void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx,
^~~~~~~~~~~~~~~~~~~~~~~
src/event/ngx_event_openssl.c: In function 'ngx_ssl_session_id_context':
src/event/ngx_event_openssl.c:2129:27: error: storage size of 'md' isn't known
EVP_MD_CTX md;
^~
src/event/ngx_event_openssl.c:2195:5: error: implicit declaration of function 'EVP_MD_CTX_cleanup' [-Werror=implicit-function-declaration]
EVP_MD_CTX_cleanup(&md);
^~~~~~~~~~~~~~~~~~
src/event/ngx_event_openssl.c: In function 'ngx_ssl_session_ticket_key_callback':
src/event/ngx_event_openssl.c:2864:9: error: 'RAND_pseudo_bytes' is deprecated [-Werror=deprecated-declarations]
RAND_pseudo_bytes(iv, 16);
^~~~~~~~~~~~~~~~~
In file included from /usr/include/openssl/engine.h:19:0,
from src/event/ngx_event_openssl.h:22,
from src/core/ngx_core.h:80,
from src/event/ngx_event_openssl.c:9:
/usr/include/openssl/rand.h:47:1: note: declared here
DEPRECATEDIN_1_1_0(int RAND_pseudo_bytes(unsigned char *buf, int num))
^
cc1: all warnings being treated as errors
make[1]: *** [objs/src/event/ngx_event_openssl.o] Error 1
objs/Makefile:748: recipe for target 'objs/src/event/ngx_event_openssl.o' failed
make[1]: Leaving directory '/tmp/nginx/nginx-1.8.0'
make: *** [install] Error 2
This is the docker fork I am running https://github.com/meteorhacks/mup-frontend-server
You are getting various errors and warnings here, but they aren't really about Docker or OpenSSL. If we strip away the extraneous information, here are the problems you are encountering.
error: 'OPENSSL_config' is deprecated
error: 'RSA_generate_key' is deprecated
error: dereferencing pointer to incomplete type 'DH {aka struct dh_st}'
error: dereferencing pointer to incomplete type 'SSL {aka struct ssl_st}'
error: 'SSL_R_NO_CIPHERS_PASSED' undeclared (first use in this function)
error: passing argument 2 of 'SSL_CTX_sess_set_get_cb' from incompatible pointer type
error: storage size of 'md' isn't known
error: implicit declaration of function 'EVP_MD_CTX_cleanup'
error: 'RAND_pseudo_bytes' is deprecated
The core of the problem here is probably that you are using a legacy version of Nginx in this project. From the GitHub repository you pointed to, in install-nginx.sh:
NGINX_VERSION=1.8.0
The current mainline version of Nginx is 1.13.2. I haven't combed through the changelogs for Nginx, but based on the errors you are receiving, it seems likely that between the 1.8 releases and the current ones, OpenSSL has deprecated various functions that Nginx 1.8 relied on. Most likely this can be solved by moving to a recent release of Nginx.
As of this writing, 1.13.2 is the current mainline, and 1.12.0 is the current stable. One of those may work better. Whether you can simply drop this in, I can't say. You may have to change something in the build scripts or the nginx config for a more recent version to work properly.
you are getting this error because your nginx version don't support SSL 1.1.0. Either upgrade NGINX version or use SSL 1.0.2.

Are custom sources supported with the IMFCaptureEngine?

I've got a custom source that seams to work with a simple topology. When QueryInterface gets called the stack looks like this:
MySource.dll!MySource::QueryInterface(const _GUID & riid, void * * ppv) Line 83 C++
mfcore.dll!CMediaEventPtr::GetUnknown(struct IMFMediaEvent *,struct _GUID const &,void * *) Unknown
mfcore.dll!CMPSourceManager::OnNewStream() Unknown
mfcore.dll!CMPSourceManager::OnSourceEvent() Unknown
mfcore.dll!CMPSourceManager::OnSourceEventAsyncCallback::Invoke(struct IMFAsyncResult *) Unknown
Using the same custom source without a topology, letting IMFCaptureEngine deal with that. When QueryInterface gets called the stack looks like this:
MySource.dll!MySource::QueryInterface(const _GUID & riid, void * * ppv) Line 42 C++
mfcore.dll!CMediaEventPtr::GetUnknown(struct IMFMediaEvent *,struct _GUID const &,void * *) Unknown
mfcore.dll!CSeqSourceWrap::HandleUpdatedStream(struct IMFMediaEvent *) Unknown
mfcore.dll!CSeqSourceWrap::OnSourceEvent() Unknown
mfcore.dll!CSeqSourceWrap::OnSourceEventAsyncCallback::Invoke(struct IMFAsyncResult *) Unknown
In the topo case, I then get a call to GetStreamDescriptor and RequestSample and everything works.
MySourceCPP_COM.dll!MyStream::GetStreamDescriptor(IMFStreamDescriptor * * ppStreamDescriptor) Line 187 C++
mfcore.dll!CMPSourceManager::OnNewStream() Unknown
mfcore.dll!CMPSourceManager::OnSourceEvent() Unknown
mfcore.dll!CMPSourceManager::OnSourceEventAsyncCallback::Invoke(struct IMFAsyncResult *) Unknown
MySourceCPP_COM.dll!MyStream::RequestSample(IUnknown * pToken) Line 208 C++
mfcore.dll!CMPSourceNodeInfo::RequestSample() Unknown
mfcore.dll!CMPSourceNodeInfo::GenerateData() Unknown
mfcore.dll!CMPSourceNodeInfo::ProcessSample() Unknown
mfcore.dll!CMPWalker::ProcessCommands() Unknown
mfcore.dll!CMFMediaProcessor::ProcessSample() Unknown
mfcore.dll!CMFMediaProcessorStream::_RequestSample() Unknown
mfcore.dll!CMFMediaProcessorStream::RequestSample(struct IUnknown *) Unknown
mfcore.dll!CBitPump::HandleSinkRequestSample() Unknown
mfcore.dll!CBitPump::OnSinkEvent() Unknown
mfcore.dll!CBitPump::OnSinkEventAsyncCallback::Invoke(struct IMFAsyncResult *) Unknown
In the IMFCaptureEngine case I never get either call so data never flows.
I see the only difference is CMPSourceManager vs. CSeqSourceWrap.

QDialog disappears after creation, but stays modal

Sometimes, a modal popup dialog (QDialog subclass) will disappear or hide 'on its own'; it will continue to block all events to the main page but will be invisible, thus forcing a program restart. This will happen on some runs of the program but not others, with what appear to be identical inputs. Using the debugger, I can see that the program is indeed stopped on the exec() function call. However since the dialog is invisible there is no way to interact with it. The dialog is created with
QDialog( parent, Qt::Dialog | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint )
and
setModal(true);
How can I figure out what's going on here?
Edit 1: A little more code although I don't think it adds much:
ModalDialog dialog( this, "Display text" );
dialog.Run(); //Just calls exec()
It's really as simple as this. However, the call stack might be more revealing; Hooli.exe!ModalDialog::Run(bool async) occurs twice--how could that happen?
ntdll.dll!773901fd() Unknown [Frames below may be incorrect and/or
missing, no symbols loaded for ntdll.dll]
ntdll.dll!773901fd() Unknown KernelBase.dll!758e170b() Unknown
KernelBase.dll!758e1641() Unknown user32.dll!74ec77d3() Unknown
user32.dll!74ed087a() Unknown Qt5Cored.dll!6659d658() Unknown
Qt5Widgetsd.dll!64249590() Unknown
Qt5Widgetsd.dll!6429fe0f() Unknown Qt5Cored.dll!662b5eed() Unknown
msvcr110d.dll!_unlock(int locknum) Line 366 C
msvcr110d.dll!_free_dbg(void * pUserData, int nBlockUse) Line
1270 C++ msvcr110d.dll!_free_dbg(void * pUserData, int nBlockUse)
Line 1267 C++ Qt5Cored.dll!66272413() Unknown
Qt5Widgetsd.dll!64384d57() Unknown
Qt5Widgetsd.dll!64249590() Unknown
Qt5Widgetsd.dll!6429fe0f() Unknown msvcr110d.dll!_unlock(int
locknum) Line 366 C msvcr110d.dll!operator delete(void * pUserData)
Line 57 C++ msvcr110d.dll!operator delete(void * pUserData) Line
56 C++ Qt5Cored.dll!6668b5b5() Unknown
Qt5Cored.dll!662b5eed() Unknown Qt5Widgetsd.dll!64384d57() Unknown
Qt5Widgetsd.dll!64253b6d() Unknown
Qt5Widgetsd.dll!64251cd5() Unknown verifier.dll!10acab48() Unknown
verifier.dll!10ac9807() Unknown verifier.dll!10ac9813() Unknown
Qt5Cored.dll!662b5eed() Unknown Qt5Widgetsd.dll!64253b6d() Unknown
Qt5Widgetsd.dll!64251cd5() Unknown
Qt5Widgetsd.dll!64249590() Unknown
Qt5Widgetsd.dll!6429fe0f() Unknown
Qt5Widgetsd.dll!64249590() Unknown
Qt5Widgetsd.dll!6429fe0f() Unknown
Qt5Widgetsd.dll!64262543() Unknown
Qt5Widgetsd.dll!6429f909() Unknown
Qt5Widgetsd.dll!6423f6e4() Unknown
Qt5Widgetsd.dll!6470af14() Unknown Qt5Cored.dll!6651591b() Unknown
verifier.dll!10ac98bc() Unknown KernelBase.dll!758e5500() Unknown
KernelBase.dll!758e55f3() Unknown imm32.dll!755f1db3() Unknown
imm32.dll!755f1ed8() Unknown msctf.dll!75346306() Unknown
msctf.dll!753462ec() Unknown msctf.dll!7534467c() Unknown
msctf.dll!753441b5() Unknown msctf.dll!753441b5() Unknown
user32.dll!74ec62fa() Unknown msctf.dll!753441b5() Unknown
msctf.dll!753441b5() Unknown user32.dll!74ec6d91() Unknown
user32.dll!74ec6ce9() Unknown user32.dll!74ec6d91() Unknown
Qt5Widgetsd.dll!64284b8f() Unknown msctf.dll!753441b5() Unknown
msctf.dll!753441b5() Unknown user32.dll!74ecd69b() Unknown
user32.dll!74ecd762() Unknown user32.dll!74ecd71e() Unknown
user32.dll!74ec62fa() Unknown user32.dll!74ec6d91() Unknown
user32.dll!74ec6ce9() Unknown user32.dll!74ec6d91() Unknown
user32.dll!74ec966e() Unknown user32.dll!74ecd70c() Unknown
verifier.dll!10ac98bc() Unknown user32.dll!74ec6210() Unknown
user32.dll!74ec6b34() Unknown qwindowsd.dll!1971dad1() Unknown
msctf.dll!753441b5() Unknown user32.dll!74ec62fa() Unknown
user32.dll!74ec6d91() Unknown user32.dll!74ec6ce9() Unknown
user32.dll!74ec6d91() Unknown user32.dll!74ec6ce9() Unknown
user32.dll!74ec966e() Unknown user32.dll!74ec96d5() Unknown
user32.dll!74ecda5b() Unknown user32.dll!74ec978a() Unknown
user32.dll!74ecda73() Unknown user32.dll!74ecd9bc() Unknown
user32.dll!74ecadb3() Unknown user32.dll!74ec62fa() Unknown
user32.dll!74ec6d91() Unknown user32.dll!74ec6ce9() Unknown
user32.dll!74ec6d91() Unknown user32.dll!74ec966e() Unknown
user32.dll!74ecd70c() Unknown user32.dll!74ec6210() Unknown
user32.dll!74ec6b34() Unknown user32.dll!74ec6b00() Unknown
user32.dll!74ec6b00() Unknown qwindowsd.dll!1971dad1() Unknown
user32.dll!74ec6ce9() Unknown user32.dll!74ec6d91() Unknown
user32.dll!74ec966e() Unknown user32.dll!74ec96d5() Unknown
Qt5Widgetsd.dll!642a88a6() Unknown
Qt5Widgetsd.dll!6429f820() Unknown Qt5Cored.dll!662b5eed() Unknown
Qt5Cored.dll!662b5eed() Unknown Qt5Widgetsd.dll!64384d57() Unknown
Qt5Widgetsd.dll!64253b6d() Unknown
Qt5Widgetsd.dll!64251cd5() Unknown
msvcr110d.dll!_heap_alloc_base(unsigned int size) Line 57 C
Qt5Widgetsd.dll!64235309() Unknown
Qt5Widgetsd.dll!64236cb7() Unknown
Qt5Widgetsd.dll!644f2e63() Unknown
Qt5Widgetsd.dll!644f0c32() Unknown Hooli.exe!ModalDialog::Run(bool
async) Line 195 C++ Qt5Cored.dll!6654df39() Unknown
Qt5Cored.dll!6654d981() Unknown Qt5Widgetsd.dll!6470d6da() Unknown
Qt5Widgetsd.dll!643a6df8() Unknown
Qt5Widgetsd.dll!643a6417() Unknown
Qt5Widgetsd.dll!643a5852() Unknown
Qt5Widgetsd.dll!6429f33d() Unknown
Qt5Widgetsd.dll!643a53b1() Unknown
Qt5Widgetsd.dll!6446703b() Unknown
Qt5Widgetsd.dll!64253b5e() Unknown
Qt5Widgetsd.dll!642505fb() Unknown Qt5Cored.dll!6650c2e4() Unknown
user32.dll!74ec8940() Unknown uxtheme.dll!70196e9f() Unknown
qwindowsd.dll!197447cc() Unknown Qt5Cored.dll!6650804c() Unknown
Qt5Cored.dll!66508252() Unknown Qt5Widgetsd.dll!644f0c45() Unknown
Qt5Cored.dll!662bcfbd() Unknown
Hooli.exe!ModalDialog::Run(bool async) Line 195 C++ Hooli.exe!Hooli::HomePage::PerformFileOperation(Hooli::HomePage::eFileOperation
operation) Line 727 C++ Hooli.exe!Hooli::HomePage::onCopy() Line
960 C++ Hooli.exe!Hooli::HomePage::qt_static_metacall(QObject * _o,
QMetaObject::Call _c, int _id, void * * _a) Line 242 C++
Edit 2: Here's the constructor for ModalDialog:
ModalDialog::ModalDialog( QWidget* pParent, const QString& rTitle, const QString& rDescription, eButtonWords words, eModalType type )
: QDialog( pParent, Qt::Dialog | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint ),
...
{
//We must have a parent to inherit the stylesheet
Q_ASSERT( pParent );
setModal( true );
setAttribute(Qt::WA_TranslucentBackground);
mpDialogBackground = new QWidget( this );
mpDialogBackground->setObjectName( "ModalBackground" );
mpTitle = new QLabel( rTitle, this );
mpTitle->setObjectName( "ModalTitle" );
mpTitle->setWordWrap( true );
mpTitle->setStyleSheet( QString("font: bold %1pt; ").arg(FONT_SIZE) );
switch( type )
{
case ModalType_ACTION_REQUIRED:
{
mpTitle->setProperty( "ModalType", "ActionRequired" );
}
break;
case ModalType_CONFIRM:
{
mpTitle->setProperty( "ModalType", "Confirm" );
}
break;
case ModalType_SUCCESS:
{
mpTitle->setProperty( "ModalType", "Success" );
}
break;
case ModalType_WARNING:
{
mpTitle->setProperty( "ModalType", "Warning" );
}
break;
case ModalType_FAILURE:
{
mpTitle->setProperty( "ModalType", "Failure" );
}
break;
case ModalType_DEFAULT:
default:
//do nothing
break;
}
mpIconLabel = new QLabel( this );
mpDescription = new QLabel( rDescription, this );
mpDescription->setObjectName( "ModalDescription" );
mpDescription->setWordWrap( true );
mpDescription->setStyleSheet( QString("font: %1pt;").arg(FONT_SIZE) );
mpButtonArea = new QWidget( this );
mpButtonArea->setObjectName( "ModalButtonArea" );
mpOkButton = new QPushButton( this );
mpOkButton->resize( DEFAULT_BUTTON_WIDTH, DEFAULT_BUTTON_HEIGHT );
connect( mpOkButton, SIGNAL( released() ), this, SLOT( OnYesOk() ) );
mpCancelButton = new QPushButton( this );
mpCancelButton->resize( DEFAULT_BUTTON_WIDTH, DEFAULT_BUTTON_HEIGHT );
connect( mpCancelButton, SIGNAL( released() ), this, SLOT( OnNoCancel() ) );
mpSpecialCancelButton = new QPushButton( this );
mpSpecialCancelButton->resize( DEFAULT_BUTTON_WIDTH, DEFAULT_BUTTON_HEIGHT );
connect( mpSpecialCancelButton, SIGNAL( released() ), this, SLOT( OnSpecialCancel() ) );
mpSpecialCancelButton->hide();
setPixmapBackground( GuiCommon::cPixmap( ":/mypixmap.png" ), true );
SetButtonStrings( mOkText, mCancelText, mYesText, mNoText );
//The actual widget size is the size of the window because
//a semi-transparent cover is put over the background.
setFixedSize( WIDTH, HEIGHT );
SetSize( DEFAULT_POPUP_WIDTH, DEFAULT_POPUP_HEIGHT );
}

Error while compiling: invalid conversion from 'void*' to 'unsigned char*'

Im programming an Arduino mega 2560.
And I bought an tft LCD and for that I want to use a SD card so I can put my pictures on it.
I downloaded this library but its giving me errors.
C:\Arduino\libraries\pff\pff.cpp: In function 'FRESULT pf_read(void*, short unsigned int, short unsigned int*)':
C:\Arduino\libraries\pff\pff.cpp:585: error: invalid conversion from 'void*' to 'unsigned char*'
The problem is imo here:
pff.cpp:
FRESULT pf_read (
void* buff, /* Pointer to the read buffer (NULL:Forward data to the stream)*/
WORD btr, /* Number of bytes to read */
WORD* br /* Pointer to number of bytes read */
)
pff.h:
FRESULT pf_read (void*, WORD, WORD*); /* Read data from the open file */
When I make it a .c file, it gives me more errors, like this one:
tft_menu.cpp.o: In function `open_root_dir()':
C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:594: undefined reference to `pf_opendir(_DIR_*, char const*)'
tft_menu.cpp.o: In function `mount_sd()':
C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:583: undefined reference to `disk_initialize()'
C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:585: undefined reference to `pf_mount(_FATFS_*)'
tft_menu.cpp.o: In function `bitmap_show(char*)':
C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:472: undefined reference to `pf_open(char const*)'
C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:476: undefined reference to `pf_read(void*, unsigned short, unsigned short*)'
C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:518: undefined reference to `pf_read(void*, unsigned short, unsigned short*)'
tft_menu.cpp.o: In function `show_bitmap()':
C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:603: undefined reference to `pf_readdir(_DIR_*, _FILINFO_*)'
so I think it should be compiled as a cpp.
EDIT:
I found out that I have to save is as cpp and in the program I have to write what icktoofay states
After that I got some errors, so I went to the line 585, as stated above and changed
BYTE *rbuff = buff;
into
BYTE rbuff = (unsigned char) buff;
And I found out that I had to add mcc.h to get rid of the errors of the "couldnt find resources".
And now Im getting these errors:
C:\libraries\mmc/mmc.h: In function 'void init_spi()':
C:\libraries\mmc/mmc.h:21: error: 'PORTL' was not declared in this scope
C:\libraries\mmc/mmc.h:21: error: 'PORTL0' was not declared in this scope
C:\libraries\mmc/mmc.h:22: error: 'PORTB' was not declared in this scope
C:\libraries\mmc/mmc.h:22: error: 'PORTB2' was not declared in this scope
C:\libraries\mmc/mmc.h:22: error: 'PORTB1' was not declared in this scope
C:\libraries\mmc/mmc.h:23: error: 'DDRB' was not declared in this scope
C:\libraries\mmc/mmc.h:23: error: 'PORTB0' was not declared in this scope
C:\libraries\mmc/mmc.h:25: error: 'DDRL' was not declared in this scope
C:\libraries\mmc/mmc.h:27: error: 'SPCR' was not declared in this scope
C:\libraries\mmc/mmc.h:27: error: 'SPE' was not declared in this scope
C:\libraries\mmc/mmc.h:27: error: 'MSTR' was not declared in this scope
C:\libraries\mmc/mmc.h:28: error: 'SPSR' was not declared in this scope
C:\libraries\mmc/mmc.h:28: error: 'SPI2X' was not declared in this scope
Ive tried to add #include TFT_ARDUINO_MEGA.h on top of the mcc.h and still no luck
Compile it as a C file, but in the file that uses it, include pff.h like this:
extern "C" {
#include <pff.h>
}

Resources