View Full Version : Building QExtserialport with Visual Studio 2008
bnilsson
5th June 2009, 11:06
I have a problem with QExtserialport built with VS 2008:
In the example "qespta" I get
.\MessageWindow.cpp(94) : error C2061: syntax error : identifier '{ctor}'
.\MessageWindow.cpp(122) : error C2061: syntax error : identifier '{ctor}'
The first (94) here on line 4
void MessageWindow::customEvent(QEvent* event)
{
if (static_cast<MessageWindow::EventType>(event->type()) == MessageWindow::MessageEvent)
msgTextEdit.append(dynamic_cast<MessageEvent::MessageEvent* >(event)->msg);
}
and the second (122)
QCoreApplication::postEvent(this, new MessageEvent::MessageEvent(qmsg));
I don't get this on OSX XCode, and not with the Win32 mingw compiler.
Does anybody have a clue where the problem might be?
BN
wysota
7th June 2009, 10:14
The problem is probably in the name clash between the namespace and the class name. Try stripping "MessageEvent::" from the cast and it should work.
bnilsson
7th June 2009, 11:28
I already tried that:
void MessageWindow::customEvent(QEvent* event)
{
if (static_cast<MessageWindow::EventType>(event->type()) == MessageWindow::MessageEvent)
msgTextEdit.append(dynamic_cast<MessageEvent* >(event)->msg);
}
------ Build started: Project: QESPTA, Configuration: Release Win32 ------
Compiling...
MessageWindow.cpp
.\MessageWindow.cpp(94) : error C2061: syntax error : identifier 'MessageEvent'
.\MessageWindow.cpp(122) : error C2061: syntax error : identifier '{ctor}'
Build log was saved at "file://c:\Documents and Settings\bnilsson\My Documents\Visual Studio 2008\Projects\qextserialport-1.2win-alpha\examples\qespta\obj\BuildLog.htm"
QESPTA - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
It need some more to work.
wysota
7th June 2009, 11:31
You can try "using namespace" or prefixing the namespace with "::". Or just change the offending name.
bnilsson
7th June 2009, 11:33
I am really, really sorry, but this is beyond me.
Could you be more specific?
bnilsson
7th June 2009, 11:38
Is this what you refer to?
public:
enum EventType {MessageEvent = 1001}; ///< Custom event types.
I changed it to
public:
enum EventType {nMessageEvent = 1001}; ///< Custom event types.
and fixed the subsequent errors, but the 'ctor' errors remains.
bnilsson
7th June 2009, 12:01
Ok, I see that it is not the conflict above you refer to.
Where is the namespace conflict?
What name is offending?
bnilsson
7th June 2009, 12:15
Ok, got it.
This worked:
void MessageWindow::customEvent(QEvent* event)
{
if (static_cast<MessageWindow::EventType>(event->type()) == MessageWindow::MessageEvent)
msgTextEdit.append(dynamic_cast<::MessageEvent* >(event)->msg);
}
Thanks for your patience.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.