MarkoSan
3rd December 2007, 16:43
Hello again! I need hlp pls!
I have include file globals.h and here is its contens:
// globals.h
#ifndef GLOBALS_H
#define GLOBALS_H
// qt includes
#include <QtGlobal>
// scene rect coords
static const qint16 minX=-300;
static const qint16 minY=-300;
static const qint16 maxX=300; // scene width
static const qint16 maxY=300; // scene height
if (minX<=0) {
static const qreal rCenterX=(maxX+minX)/2; // scente centre x
} else {
static const qreal rCenterX=(maxX-minX)/2; // scente centre x
};
if (minY<=0) {
static const qreal rCenterY=(maxY+minY)/2; // scente centre x
} else {
static const qreal rCenterY=(maxY-minY)/2; // scente centre x
};
static const qreal rCirleMargin=20.0; // circle margin
static const qreal rCircleRadius=maxX-rCenterX-rCirleMargin; // radius of circle
// geometric constants
static const qreal pi=3.141592653589793238462643383279502884197169399 37510; // pi constant
static const qreal Pi=pi; // alias for pi
static const quint8 iLoadTreshold=10; // icon load treshold
static const qreal rFullCircle=360; // full circle has 360 degrees
static const qreal rAngle=rFullCircle/iLoadTreshold; // merchandize icon appears every rAngle degrees on rotary
// merchandize selector
#endif
If I include this file into project, I get following weird compiler errors:
C:\Documents and Settings\markofr\workspace\eROS>make
mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `C:/Documents and Settings/markofr/workspace
/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\CLens.o CLens.cpp
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\cdatabasefoundation.o cdatabasefoundation.cpp
In file included from cdatabasefoundation.h:7,
from cdatabasefoundation.cpp:1:
globals.h:15: error: expected unqualified-id before "if"
globals.h:15: error: expected `,' or `;' before "if"
globals.h:17: error: expected unqualified-id before "else"
globals.h:17: error: expected `,' or `;' before "else"
globals.h:21: error: expected unqualified-id before "if"
globals.h:21: error: expected `,' or `;' before "if"
globals.h:23: error: expected unqualified-id before "else"
globals.h:23: error: expected `,' or `;' before "else"
globals.h:28: error: `rCenterX' was not declared in this scope
cdatabasefoundation.cpp:38:2: warning: no newline at end of file
mingw32-make[1]: *** [debug\cdatabasefoundation.o] Error 1
mingw32-make[1]: Leaving directory `C:/Documents and Settings/markofr/workspace/
eROS'
mingw32-make: *** [debug] Error 2
Wtf????
I have include file globals.h and here is its contens:
// globals.h
#ifndef GLOBALS_H
#define GLOBALS_H
// qt includes
#include <QtGlobal>
// scene rect coords
static const qint16 minX=-300;
static const qint16 minY=-300;
static const qint16 maxX=300; // scene width
static const qint16 maxY=300; // scene height
if (minX<=0) {
static const qreal rCenterX=(maxX+minX)/2; // scente centre x
} else {
static const qreal rCenterX=(maxX-minX)/2; // scente centre x
};
if (minY<=0) {
static const qreal rCenterY=(maxY+minY)/2; // scente centre x
} else {
static const qreal rCenterY=(maxY-minY)/2; // scente centre x
};
static const qreal rCirleMargin=20.0; // circle margin
static const qreal rCircleRadius=maxX-rCenterX-rCirleMargin; // radius of circle
// geometric constants
static const qreal pi=3.141592653589793238462643383279502884197169399 37510; // pi constant
static const qreal Pi=pi; // alias for pi
static const quint8 iLoadTreshold=10; // icon load treshold
static const qreal rFullCircle=360; // full circle has 360 degrees
static const qreal rAngle=rFullCircle/iLoadTreshold; // merchandize icon appears every rAngle degrees on rotary
// merchandize selector
#endif
If I include this file into project, I get following weird compiler errors:
C:\Documents and Settings\markofr\workspace\eROS>make
mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `C:/Documents and Settings/markofr/workspace
/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\CLens.o CLens.cpp
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\cdatabasefoundation.o cdatabasefoundation.cpp
In file included from cdatabasefoundation.h:7,
from cdatabasefoundation.cpp:1:
globals.h:15: error: expected unqualified-id before "if"
globals.h:15: error: expected `,' or `;' before "if"
globals.h:17: error: expected unqualified-id before "else"
globals.h:17: error: expected `,' or `;' before "else"
globals.h:21: error: expected unqualified-id before "if"
globals.h:21: error: expected `,' or `;' before "if"
globals.h:23: error: expected unqualified-id before "else"
globals.h:23: error: expected `,' or `;' before "else"
globals.h:28: error: `rCenterX' was not declared in this scope
cdatabasefoundation.cpp:38:2: warning: no newline at end of file
mingw32-make[1]: *** [debug\cdatabasefoundation.o] Error 1
mingw32-make[1]: Leaving directory `C:/Documents and Settings/markofr/workspace/
eROS'
mingw32-make: *** [debug] Error 2
Wtf????