Results 1 to 5 of 5

Thread: __cplusplus undefined on Symbian

  1. #1
    Join Date
    Nov 2007
    Posts
    89
    Thanked 21 Times in 18 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default __cplusplus undefined on Symbian

    Hi.
    I'm facing some odd problem with my application. I tried this main.cpp
    Qt Code:
    1. #if ! defined __cplusplus
    2. # error "Not C++!"
    3. #endif
    4.  
    5. #include <iostream>
    6.  
    7. int main()
    8. {
    9. std::cout << "Hello" << std::endl;
    10. return 0;
    11. }
    To copy to clipboard, switch view to plain text mode 

    Then I open the Qt for Symbian prompt, run qmake and run make release-gcce. Then compilation stops due to "Not C++!" error message.

    I use some libraries which have such checks, I found a workaround by adding DEFINES *= __cplusplus in the project file, then everything compiles correctly (so the C++ compiler is actually used, not the C one). Obviously I'm not quite satisfied with this, that macro should be defined automatically by the compiler.

    Any idea what I'm doing wrong?

  2. #2
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: __cplusplus undefined on Symbian

    I'm not used to the construct '#if ! defined __cplusplus'; I usually see this written as '#ifndef ...' or '#if !defined' (without the space), with the first being by far the most common. Try these and see if they work; if so, your preprocessor isn't quite up to snuff.

  3. #3
    Join Date
    Nov 2007
    Posts
    89
    Thanked 21 Times in 18 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: __cplusplus undefined on Symbian

    In the libraries it is actually written as "#ifndef ...", I also just tried it in my minimal example and still no changes. Also, after having defined the value manually it is recognised even with that syntax.

  4. #4
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: __cplusplus undefined on Symbian

    Then it appears your compiler isn't defining the symbol. The last thing to check would be what compiler your build system is invoking; it's vaguely possible that it is using the C compiler for some reason, although that seems unlikely. If it turns out to be using the C++ compiler, you should contact whoever provides that compiler and let them know about this.

  5. #5
    Join Date
    Nov 2007
    Posts
    89
    Thanked 21 Times in 18 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: __cplusplus undefined on Symbian

    I'd say it is the C++ compiler, since after defining manually __cplusplus (or removing the check) it compiles C++ code (classes, templates…). The compiler is the one installed with Qt for Symbian (or Symbian SDK, I don't remember who exactly installed it, I just followed the installation procedure for Qt for Symbian), and should be some version of GCC. I was hoping someone could try the code and see if this happens only to me.

Similar Threads

  1. Can't run Qt app on Symbian
    By baluk in forum Newbie
    Replies: 1
    Last Post: 12th December 2010, 11:26
  2. Symbian WAP Apn
    By Hollow Heart in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 10th October 2010, 15:14
  3. Replies: 1
    Last Post: 9th September 2010, 16:49
  4. GL For Symbian
    By TJSonic in forum Qt for Embedded and Mobile
    Replies: 3
    Last Post: 21st June 2010, 23:43
  5. In Symbian?
    By martinn in forum Qwt
    Replies: 1
    Last Post: 25th February 2010, 10:33

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.