Results 1 to 8 of 8

Thread: Building QExtserialport with Visual Studio 2008

  1. #1
    Join Date
    Jan 2008
    Posts
    155
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Building QExtserialport with Visual Studio 2008

    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
    Qt Code:
    1. void MessageWindow::customEvent(QEvent* event)
    2. {
    3. if (static_cast<MessageWindow::EventType>(event->type()) == MessageWindow::MessageEvent)
    4. msgTextEdit.append(dynamic_cast<MessageEvent::MessageEvent* >(event)->msg);
    5. }
    To copy to clipboard, switch view to plain text mode 
    and the second (122)
    Qt Code:
    1. QCoreApplication::postEvent(this, new MessageEvent::MessageEvent(qmsg));
    To copy to clipboard, switch view to plain text mode 

    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
    Last edited by bnilsson; 5th June 2009 at 11:52.
    MacOSX user dabbling with Linux and Windows.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Building QExtserialport with Visual Studio 2008

    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.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jan 2008
    Posts
    155
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Building QExtserialport with Visual Studio 2008

    I already tried that:
    Qt Code:
    1. void MessageWindow::customEvent(QEvent* event)
    2. {
    3. if (static_cast<MessageWindow::EventType>(event->type()) == MessageWindow::MessageEvent)
    4. msgTextEdit.append(dynamic_cast<MessageEvent* >(event)->msg);
    5. }
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. ------ Build started: Project: QESPTA, Configuration: Release Win32 ------
    2. Compiling...
    3. MessageWindow.cpp
    4. .\MessageWindow.cpp(94) : error C2061: syntax error : identifier 'MessageEvent'
    5. .\MessageWindow.cpp(122) : error C2061: syntax error : identifier '{ctor}'
    6. 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"
    7. QESPTA - 2 error(s), 0 warning(s)
    8. ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
    To copy to clipboard, switch view to plain text mode 
    It need some more to work.
    MacOSX user dabbling with Linux and Windows.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Building QExtserialport with Visual Studio 2008

    You can try "using namespace" or prefixing the namespace with "::". Or just change the offending name.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Jan 2008
    Posts
    155
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Building QExtserialport with Visual Studio 2008

    I am really, really sorry, but this is beyond me.
    Could you be more specific?
    MacOSX user dabbling with Linux and Windows.

  6. #6
    Join Date
    Jan 2008
    Posts
    155
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Building QExtserialport with Visual Studio 2008

    Is this what you refer to?
    Qt Code:
    1. public:
    2. enum EventType {MessageEvent = 1001}; ///< Custom event types.
    To copy to clipboard, switch view to plain text mode 
    I changed it to
    Qt Code:
    1. public:
    2. enum EventType {nMessageEvent = 1001}; ///< Custom event types.
    To copy to clipboard, switch view to plain text mode 
    and fixed the subsequent errors, but the 'ctor' errors remains.
    MacOSX user dabbling with Linux and Windows.

  7. #7
    Join Date
    Jan 2008
    Posts
    155
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Building QExtserialport with Visual Studio 2008

    Ok, I see that it is not the conflict above you refer to.
    Where is the namespace conflict?
    What name is offending?
    MacOSX user dabbling with Linux and Windows.

  8. #8
    Join Date
    Jan 2008
    Posts
    155
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Building QExtserialport with Visual Studio 2008

    Ok, got it.
    This worked:
    Qt Code:
    1. void MessageWindow::customEvent(QEvent* event)
    2. {
    3. if (static_cast<MessageWindow::EventType>(event->type()) == MessageWindow::MessageEvent)
    4. msgTextEdit.append(dynamic_cast<::MessageEvent* >(event)->msg);
    5. }
    To copy to clipboard, switch view to plain text mode 
    Thanks for your patience.
    MacOSX user dabbling with Linux and Windows.

  9. The following user says thank you to bnilsson for this useful post:

    marcvanriet (10th September 2010)

Similar Threads

  1. Problem building qt embedded for WinCE and VS2005
    By high_flyer in forum Qt for Embedded and Mobile
    Replies: 2
    Last Post: 5th June 2009, 01:04
  2. Qt 4.4.1 deployement with Visual Studio Express 2008
    By abrou in forum Installation and Deployment
    Replies: 8
    Last Post: 28th February 2009, 02:13
  3. Qt 4.4.1 Compile Error with MS Visual C++ 2008 Express SP1
    By BrainB0ne in forum Installation and Deployment
    Replies: 3
    Last Post: 19th August 2008, 15:49
  4. Qt configure with msvc.net
    By jivanr in forum Installation and Deployment
    Replies: 1
    Last Post: 11th June 2007, 08:17
  5. Qt Cryptographic Architecture
    By vermarajeev in forum Qt Programming
    Replies: 6
    Last Post: 9th February 2007, 13:15

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.