PDA

View Full Version : quint16 compiling problem



MarkoSan
30th November 2007, 16:20
Hello!

Here is code:
// globals.h

#ifndef GLOBALS_H
#define GLOBALS_H

// qt includes
#include <QtGlobal>

// scene rect coords
static const unsigned quint16 minX=0;
static const unsigned quint16 minY=0;
static const unsigned quint16 maxX=400;
static const unsigned quint16 maxY=400;

#endifI've added globals.h into .pro file and then i run
qmake and after
makeI get following errors:
mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `C:/DOCUME~1/markofr/WORKSP~1/eROS'
c:\Qt\4.3.2\bin\uic.exe crosmainwindow.ui -o ui_crosmainwindow.h
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -
DQT_DLL -DQT_SVG_LIB -DQT_SQL_LIB -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB
-DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\..\..\Qt\4.3.2\inclu
de\QtCore" -I"..\..\..\..\Qt\4.3.2\include\QtCore" -I"..\..\..\..\Qt\4.3.2\inclu
de\QtNetwork" -I"..\..\..\..\Qt\4.3.2\include\QtNetwork" -I"..\..\..\..\Qt\4.3.2
\include\QtGui" -I"..\..\..\..\Qt\4.3.2\include\QtGui" -I"..\..\..\..\Qt\4.3.2\i
nclude\QtOpenGL" -I"..\..\..\..\Qt\4.3.2\include\QtOpenGL" -I"..\..\..\..\Qt\4.3
.2\include\QtSql" -I"..\..\..\..\Qt\4.3.2\include\QtSql" -I"..\..\..\..\Qt\4.3.2
\include\QtSvg" -I"..\..\..\..\Qt\4.3.2\include\QtSvg" -I"..\..\..\..\Qt\4.3.2\i
nclude" -I"c:\Qt\4.3.2\include\ActiveQt" -I"debug" -I"." -I"..\..\..\..\Qt\4.3.2
\mkspecs\win32-g++" -o debug\CMerchandizeSelector.o CMerchandizeSelector.cpp
In file included from CMerchandizeSelector.h:13,
from CMerchandizeSelector.cpp:1:
globals.h:10: error: `quint16' does not name a type
globals.h:11: error: `quint16' does not name a type
globals.h:12: error: `quint16' does not name a type
globals.h:13: error: `quint16' does not name a type
CMerchandizeSelector.cpp: In constructor `CMerchandizeSelector::CMerchandizeSele
ctor(QWidget*)':
CMerchandizeSelector.cpp:8: error: `minX' undeclared (first use this function)
CMerchandizeSelector.cpp:8: error: (Each undeclared identifier is reported only
once for each function it appears in.)
CMerchandizeSelector.cpp:8: error: `minY' undeclared (first use this function)
CMerchandizeSelector.cpp:8: error: `maxX' undeclared (first use this function)
CMerchandizeSelector.cpp:8: error: `maxY' undeclared (first use this function)
mingw32-make[1]: *** [debug\CMerchandizeSelector.o] Error 1
mingw32-make[1]: Leaving directory `C:/DOCUME~1/markofr/WORKSP~1/eROS'
mingw32-make: *** [debug] Error 2

C:\DOCUME~1\markofr\WORKSP~1\eROS>It's obviously quint16 type is not recognized. Why??

flare
30th November 2007, 16:27
According to the documentation quint16 is a typedef for "unsigned short". Could it be that with your code this then leads e.g. to "static const unsigned unsigned short minX=0;"?

Happy coding :)

MarkoSan
30th November 2007, 16:32
I know, but unsigned int IS NOT platofrm independent, quint16 IS PLATFORM INDEPENDENT on all supported platform, so I cannot use ordinary int.

jpn
30th November 2007, 16:46
He meant that it should be "static const quint16" not "static const unsigned quint16".

flare
30th November 2007, 17:04
Exactly, thats what I've meant. Sorry if my answer wasn't clear enough.

MarkoSan
30th November 2007, 18:08
Dzizus, thanks man!!!!!! What a stupid idiot mistake!!!!!!!!!!!!