PDA

View Full Version : Many errors in qvariant.h



kkk777kkk
25th May 2011, 13:16
Hi.
I am porting project from Qt3 to Qt4 also porting it to QtCreator. Project consist of huge count of files and dependencies and now i resolving unresolved symbols for linker. When i add another file to project i see many compiler errors in qvariant.h . That is strange error such as " '::~QVariant' : illegal global destructor" - it looks like it can not understand that it is name space of QVariant class but upper there is "class Q_CORE_EXPORT QVariant"; or it can not understand that "QVariant(const QString &string);" is a constructor but think that it is function and say that i need to add return type, imho second error also tells that it can not see class name space. I dont understand how it can be and how my project can cause this errors.
Help please to solve this or just show steps how such error could be investigated.

Qt 4.7.2, compiler from mvs2008

SixDegrees
25th May 2011, 15:07
QVariant does not normally throw errors. It sounds as though you're hauling Qt3 source files into your new Qt4 project.

kkk777kkk
26th May 2011, 09:04
But if i double click on error in QtCreator it sends me to qvariant from Qt4 and i check that system have no access to old qvariant

could it be because of some redeclaration or some other includes cause ?

SixDegrees
26th May 2011, 09:29
How do you know "system have no access to old qvariant"?

If there's a redefinition somewhere, it's somewhere in your code or code you're using from outside of Qt. This seems unlikely, but go ahead and look.

I still think you've got Qt3 installed on your system and Qt4 is trying to use parts of it, or vice versa.

kkk777kkk
26th May 2011, 11:19
i renamed all qt3 directories and thats why i think it cant find it

i looked for redifinition and only find that in headers generated from uis qvariant included twice

#include <qvariant.h>

#include <ActiveQt/QAxWidget>
#include <Qt3Support/Q3GroupBox>
#include <Qt3Support/Q3MimeSourceFactory>
#include <Qt3Support/Q3WidgetStack>
#include <QtCore/QVariant>

can it cause my problem why uic3 do it ?

SixDegrees
26th May 2011, 11:30
You should uninstall Qt3 completely.

Better yet, uninstall ALL Qt versions you have, then do a clean install of Qt4 only.

kkk777kkk
26th May 2011, 12:36
i unistall all qts and then install 4.7.2 but it does not solve problem...

wysota
26th May 2011, 12:37
What does your .pro file look like?

kkk777kkk
26th May 2011, 14:36
look for my .pro file in attachment i replaced file names by comments

and i found some details on problem, that file which cause this problem have many includes and i paste

#ifndef QVARIANT_H
#define QVARIANT_H
#endif

in begin of this file and it solves problem but it not good way to solve and i try to find place where qvariant includes and found that in one of includes there is #include <QTcpSocket> and if i put this hack before it the problem would be solved. But it seems for like something wrong. Have you got any idea where is error in my way?

Added after 27 minutes:

ooooh, i find it. this project is new for me thats why hard to find some things.

I undestand that <QTcpSocket> can helps me and i try moving it across file which cause my trouble and i find problem include and problem row in it. It was define

#undef CString
#define CString std::string
and "CString" code word is used by QVariant.