[Qt-interest] errors about the macro in QWidget declare file
Malyushytsky, Alex
alex at wai.com
Sun May 17 22:48:08 CEST 2009
First of all multiple post will not help you anyhow.
Are u sure u have ‘#define’ in your code and not ‘define’ as u have in your post.
Also this is completely QT unrelated.
Alex
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of iptton
Sent: Saturday, May 16, 2009 5:43 AM
To: qt-interest at trolltech.com
Subject: [Qt-interest] errors about the macro in QWidget declare file
hello list.
I am now meet a problem:
consider the follow files:
==============================
macro.h:
==============================
#ifndef MACRO_H
#define MACRO_H
define NAMESPACE fxgui
define FX_BEGIN_NAMESPACE namespace NAMESPACE {
define FX_END_NAMESPACE }
define FX_USING_NAMESPACE using namespace NAMESPACE ;
#endif
==============================
mywidget.h
==============================
#ifndef ...
...
#include "macro.h"
FX_BEGIN_NAMESPACE
class MyWidget:public QWidget{
Q_OBJECT
public:
...............
};
FX_END_NAMESPACE
============================
and the rest of mywidget.cpp ommited.
============================
the problem's : when I use FX_BEGIN_NAMESPACE , the copiler ouput : (just translate few line )
moc_mywin.cpp:38: error: ‘MyWin’ undeclared
moc_mywin.cpp:43: error: ‘MyWin’undeclared
moc_mywin.cpp:43: 错误: none-member function ‘const QMetaObject* metaObject()’ couldnot have cv
moc_mywin.cpp:48: 错误: ‘MyWin’undeclared
moc_mywin.cpp: In function ‘void* qt_metacast(const char*)’:
moc_mywin.cpp:52: 错误: expected type-specifier before ‘MyWin’
moc_mywin.cpp:52: 错误: expected `>' before ‘MyWin’
moc_mywin.cpp:52: 错误: expected `(' before ‘MyWin’
moc_mywin.cpp:52: 错误: ‘MyWin’在此作用域中尚未声明
moc_mywin.cpp:52: 错误: expected primary-expression before ‘>’ token
moc_mywin.cpp:52: 错误: 在非成员函数中使用‘this’无效
moc_mywin.cpp:52: 错误: expected `)' before ‘;’ token
moc_mywin.cpp:53: 错误: 没有对象无法调用成员函数‘virtual void* QWidget::qt_metacast(const char*)’
moc_mywin.cpp: At global scope:
moc_mywin.cpp:56: 错误: ‘MyWin’未声明
moc_mywin.cpp: In function ‘int qt_metacall(QMetaObject::Call, int, void**)’:
moc_mywin.cpp:58: 错误: 没有对象无法调用成员函数‘virtual int QWidget::qt_metacall(
QMetaObject::Call, int, void**)’
but when I just use " namespace fxgui{ " instead of the macro FX_BEING_NAMESPACE and "}" of FX_END_NAMESPACE. It's hasn't not any error!
can any body tell me why?thanks.
---------------------------------------------------------------------------------------------------
Weidlinger Associates, Inc. made the following annotations.
“This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you.”
“Please consider our environment before printing this email.”
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090517/c49ffe1e/attachment.html
More information about the Qt-interest-old
mailing list