Results 1 to 9 of 9

Thread: Working project failing to build

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2014
    Posts
    13
    Qt products
    Qt5
    Platforms
    Windows

    Default Working project failing to build

    I am using Qt Creator to work on a project. Qt Creator is v3.1.2 based on Qt 5.3.1 (MSVC 2010, 32bit). After getting a significant part of the application coded and tested I was adding a couple of new modules. I started getting errors in Qt code!!! I have no idea what is causing it.

    So I decided to start a new project and add the old code one module at a time. I have a global header file that I use to define various structures that are passed between modules. I have not changed this module at all. It has been working fine up to this point.

    Here is the module:

    Qt Code:
    1. #ifndef GLOBAL_H
    2. #define GLOBAL_H
    3.  
    4. #include <QString>
    5.  
    6. struct _RoadsData {
    7. QString state;
    8. QString cnty;
    9. QString name;
    10. QString mtfcc;
    11. QString rttype;
    12. int roadtype;
    13. QString geometry;
    14. };
    15.  
    16. struct _ContourData {
    17. QString state;
    18. QString cnty;
    19. int type;
    20. QString geometry;
    21. };
    22.  
    23. struct _ImperviousData {
    24. QString state;
    25. QString cnty;
    26. int type;
    27. QString geometry;
    28. };
    29.  
    30. struct _AreaObjectsData {
    31. QString state;
    32. QString cnty;
    33. int type;
    34. QString name;
    35. QString geometry;
    36. };
    37.  
    38. struct _ParcelData {
    39. QString state;
    40. QString cnty;
    41. QString address;
    42. QString geometry;
    43. };
    44.  
    45. struct _PointObjectsData {
    46. QString state;
    47. QString cnty;
    48. int type;
    49. QString name;
    50. QString geometry;
    51. };
    52.  
    53. struct _AddrPointData {
    54. QString state;
    55. QString cnty;
    56. int stnbr;
    57. QString geometry;
    58. };
    59.  
    60.  
    61. Q_DECLARE_METATYPE(_RoadsData)
    62. Q_DECLARE_METATYPE(_ContourData)
    63. Q_DECLARE_METATYPE(_ParcelData)
    64. Q_DECLARE_METATYPE(_AddrPointData)
    65. Q_DECLARE_METATYPE(_ImperviousData)
    66. Q_DECLARE_METATYPE(_AreaObjectsData)
    67. Q_DECLARE_METATYPE(_PointObjectsData)
    68. #endif // GLOBAL_H
    To copy to clipboard, switch view to plain text mode 
    The project builds clean if I haven't yet used this file. As soon as I include it in a module I get the following error for each of the declares:

    C3646: 'Q_DECLARE_METATYPE' : unknown override specifier
    I also get
    C2091: function returns function
    in global.h

    Also I get a bunch of errors in iterator and xfunctional.

    In searching this error I found a suggestion that I put in an include for QMetaType. (It worked fine before this without that include.) I put it in. The errors went away in global.h. But now I'm getting errors in iterator, qlist.h, qscopedpointer.h and qobject_impl.h.

    I don't know what to do!!! Please help.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Working project failing to build

    What Qt version and Microsoft Visual C++ compiler version are you using to build your project? This is not the same thing as the compiler and Qt version used to build Qt Creator.

    Do you have C++11 options in your PRO file? "override" is a C++11 specifier.

    It would generally help if you published the entire compiler output providing context to the warning/error message.

    The C++ specification reserves identifier names starting with an underscore and upper-case letter (or just an underscore in global scope, or two underscores anywhere in the identifier) for the compiler implementation. You are using these for your struct type names, and this may be causing an issue.
    http://stackoverflow.com/questions/2...a-c-identifier

Similar Threads

  1. Can't build a sample project
    By gpuckett in forum Newbie
    Replies: 3
    Last Post: 5th May 2014, 00:17
  2. I am working on a POS project
    By foxrider in forum Newbie
    Replies: 12
    Last Post: 21st April 2014, 14:48
  3. Error on try to build a project example.
    By radialdeveloper in forum Newbie
    Replies: 1
    Last Post: 25th May 2013, 22:38
  4. Shadow build of Qt 4.7.4 failing due to syncqt not running
    By robini in forum Installation and Deployment
    Replies: 3
    Last Post: 22nd February 2012, 12:11
  5. Cant build Qt project
    By ChrisBuchholz in forum Installation and Deployment
    Replies: 7
    Last Post: 20th July 2010, 23:05

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.