Results 1 to 2 of 2

Thread: Declaration problems

  1. #1
    Join Date
    May 2007
    Posts
    4
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Declaration problems

    Hi,

    This is giving me some headache:

    Qt Code:
    1. //FILE: AREA.H
    2.  
    3. #ifndef AREA_H
    4. #define AREA_H
    5.  
    6. #include <QObject>
    7.  
    8. #include "camera.h"
    9.  
    10. class Area
    11. {
    12. public:
    13. Area(QString text);
    14. ~Area();
    15.  
    16. static void Dispose();
    17.  
    18. static QList<Area*> *areas;
    19.  
    20. QList<Camera*> *cameras;
    21. QString text;
    22. private:
    23. QString name;
    24. };
    25.  
    26. #endif
    27.  
    28. //FILE:CAMERA.H
    29.  
    30. #ifndef CAMERA_H
    31. #define CAMERA_H
    32.  
    33. #include <QObject>
    34.  
    35. #include "area.h"
    36.  
    37. class Camera
    38. {
    39. public:
    40. Camera(QString text, Area* parentArea);
    41. ~Camera();
    42.  
    43. QString text;
    44. private:
    45. Area* parentArea;
    46. QString name;
    47. };
    48.  
    49. #endif
    To copy to clipboard, switch view to plain text mode 

    Compiler output: "src/camera.h:14: error: 'Area' was not declared in this scope"

    *forward declaration*

    I thought the issue is on the fact that area.h is including camera.h and vice-versa, so i tried to add "class Camera;" in area.h and "class Area;" in camera.h and then it gave the following output:

    "src/....../camera.h:14: error: ''Area' is not a type"
    "src/....../listwidgethandler.h:20: error: 'Area' is not a type"
    "src/....../listwidgethandler.h:21: error: 'Camera' is not a type"

    Ideas??

    Compiler: GCC 4.1
    OS: Linux Kubuntu Feisty Fawn (7.03)
    IDE: QDevelop
    Last edited by scarvenger; 7th May 2007 at 01:50.

  2. #2
    Join Date
    May 2007
    Posts
    4
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Declaration problems

    Ok, i found what was wrong: i had the following piece of code:

    Qt Code:
    1. enum Types
    2. {
    3. Camera,
    4. Area
    5. };
    To copy to clipboard, switch view to plain text mode 

    So frustrating [:P]

Similar Threads

  1. Replies: 2
    Last Post: 8th March 2007, 23:22
  2. Compile Errors
    By luffy27 in forum Qt Programming
    Replies: 3
    Last Post: 4th November 2006, 06:26
  3. Problems using QMap
    By importantman in forum Qt Programming
    Replies: 1
    Last Post: 27th October 2006, 23:43
  4. Problems
    By euthymos in forum Installation and Deployment
    Replies: 2
    Last Post: 13th June 2006, 20:11
  5. Problems with Q_OBJECT and subclassing
    By renaissanz in forum Qt Programming
    Replies: 4
    Last Post: 21st February 2006, 23:18

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.