-
expected constructor, destructor, or type conversion before '(' token
Hi...
I am using qnetworkaccessmanager.h header file at the top of main.cpp class in console application...
and i am getting this error.....
"expected constructor, destructor, or type conversion before '(' token"
what could be the couse for this issue...
plz help me..
thanks
-
Re: expected constructor, destructor, or type conversion before '(' token
A syntax error in your code, usually a missing semi-colon or #include, but without your code we cannot tell.
-
Re: expected constructor, destructor, or type conversion before '(' token
Thanks for ur reply.. but when I click on the error .. it takes me to qnetworkaccessmanager.h file itself and
the code is here
Code:
DECLARE_INTERFACE_(IAMMediaContent, IDispatch)
{
STDMETHOD(get_AuthorName)(THIS_ BSTR*) PURE;
STDMETHOD(get_Title)(THIS_ BSTR*) PURE;
STDMETHOD(get_Rating)(THIS_ BSTR*) PURE;
STDMETHOD(get_Description)(THIS_ BSTR*) PURE;
STDMETHOD(get_Copyright)(THIS_ BSTR*) PURE;
STDMETHOD(get_BaseURL)(THIS_ BSTR*) PURE;
STDMETHOD(get_LogoURL)(THIS_ BSTR*) PURE;
STDMETHOD(get_LogoIconURL)(THIS_ BSTR*) PURE;
STDMETHOD(get_WatermarkURL)(THIS_ BSTR*) PURE;
STDMETHOD(get_MoreInfoURL)(THIS_ BSTR*) PURE;
STDMETHOD(get_MoreInfoBannerImage)(THIS_ BSTR*) PURE;
STDMETHOD(get_MoreInfoBannerURL)(THIS_ BSTR*) PURE;
STDMETHOD(get_MoreInfoText)(THIS_ BSTR*) PURE;
};
-
Re: expected constructor, destructor, or type conversion before '(' token
What immediately precedes your #include <QNetworkAccessManager> line?
-
Re: expected constructor, destructor, or type conversion before '(' token
Thanks for ur reply.. but when I click on the error .. it takes me to qnetworkaccessmanager.h file itself and
the code is here..
Code:
DECLARE_INTERFACE_(IAMMediaContent, IDispatch)
{
STDMETHOD(get_AuthorName)(THIS_ BSTR*) PURE;
STDMETHOD(get_Title)(THIS_ BSTR*) PURE;
STDMETHOD(get_Rating)(THIS_ BSTR*) PURE;
STDMETHOD(get_Description)(THIS_ BSTR*) PURE;
STDMETHOD(get_Copyright)(THIS_ BSTR*) PURE;
STDMETHOD(get_BaseURL)(THIS_ BSTR*) PURE;
STDMETHOD(get_LogoURL)(THIS_ BSTR*) PURE;
STDMETHOD(get_LogoIconURL)(THIS_ BSTR*) PURE;
STDMETHOD(get_WatermarkURL)(THIS_ BSTR*) PURE;
STDMETHOD(get_MoreInfoURL)(THIS_ BSTR*) PURE;
STDMETHOD(get_MoreInfoBannerImage)(THIS_ BSTR*) PURE;
STDMETHOD(get_MoreInfoBannerURL)(THIS_ BSTR*) PURE;
STDMETHOD(get_MoreInfoText)(THIS_ BSTR*) PURE;
};
my header section is:
Code:
#include <QtCore/QCoreApplication>
#include <iostream>
#include <conio.h>
#include <stdio.h>
#include <qnetwork.h>
#include <qnetworkaccessmanager.h>
-
Re: expected constructor, destructor, or type conversion before '(' token
Can you post the whole main.cpp and error message (including line number) ?
-
Re: expected constructor, destructor, or type conversion before '(' token
The source you posted is <qnetwork.h> and it isn't a Qt header file.
-
Re: expected constructor, destructor, or type conversion before '(' token
My main.cpp is
Code:
#include <QtCore/QCoreApplication>
#include <iostream>
#include <conio.h>
#include <stdio.h>
#include <qnetwork.h>
#include <qnetworkaccessmanager.h>
int main(int argc, char *argv[])
{
QNetworkAccessManager *manager = new QNetworkAccessManager(this);
return a.exec();
}
and error messages are
c:\qtsdk\mingw\bin\..\lib\gcc\mingw32\4.4.0\..\..\ ..\..\include\qnetwork.h:16: error: expected constructor, destructor, or type conversion before '(' token
-
Re: expected constructor, destructor, or type conversion before '(' token
Quote:
Originally Posted by
cuteatul
My main.cpp is
Code:
#include <QtCore/QCoreApplication>
#include <iostream>
#include <conio.h>
#include <stdio.h>
#include <qnetwork.h>
#include <qnetworkaccessmanager.h>
int main(int argc, char *argv[])
{
QNetworkAccessManager *manager = new QNetworkAccessManager(this);
return a.exec();
}
and error messages are
c:\qtsdk\mingw\bin\..\lib\gcc\mingw32\4.4.0\..\..\ ..\..\include\qnetwork.h:16: error: expected constructor, destructor, or type conversion before '(' token
the problem is in the <qnetwork.h> file, try compile your main without including it.
-
Re: expected constructor, destructor, or type conversion before '(' token
Ya then it compiles successfully....
but qnetwork.h is not hard coded file ... it is a predefined file.....
so how should I look for errors in this file..................?????
-
Re: expected constructor, destructor, or type conversion before '(' token
Firstly, if your program compiles without it then you don't need it, and don't need to correct errors in it.
Secondly, as advised earlier, qnetwork.h is not part of Qt. It has dependencies that you are missing before the include, specifically:
Quote:
To define the interface identifier, include the header file Initguid.h before Qnetwork.h, but after Dshow.h and other header files:
Code:
#include <dshow.h>
#include <initguid.h>
#include <qnetwork.h>
Note Make sure that Initguid.h is included only once in your project. Otherwise, you will receive linker errors for duplicate GUID values.
as in the Microsoft docs clearly states. If there are errors internal to that file (I strongly doubt it) then you need to address that with the author.
-
Re: expected constructor, destructor, or type conversion before '(' token
Thanks.. it solves my problem.... But after doing this I am getting one error ... here is
c:\qtsdk\mingw\bin\..\lib\gcc\mingw32\4.4.0\..\..\ ..\..\include\qnetwork.h:46: error: expected unqualified-id before '}' token
and I want to be clear about if qnetwork.h is a part of qt framework or not.......
-
Re: expected constructor, destructor, or type conversion before '(' token
<qnetwork.h> is not.. Qt has <QtNetwork>