C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 19th, 2010, 04:36 PM
jbutler77 jbutler77 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2010
Posts: 1 jbutler77 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 38 sec
Reputation Power: 0
Exclamation "Cell not declared in scope" error but Cell.h included!

Hello there,

I am writting code in c++ for the first time and I think I am missing something about header file inclusion.

I have a file, Grid.hh which declares a vector of vectors of Cell objects.

I have included Cell.h and yet get an error that Cell was not declared in the scope.

The Grid.h

Code:
#ifndef _GRID_H
#define	_GRID_H

#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <vector>
#include "Grid.h"
#include "Cell.h"
#include "State.h"
#include "Phenotype.h"

using namespace std;


class Grid
{
public:
    Grid(int numberOfCells);
private:
    vector< vector<Cell> > cellGrid;
};

#endif	/* _GRID_H */


The Cell.h file:
Code:
#ifndef _CELL_H
#define	_CELL_H

#include "Phenotype.h"
#include "State.h"
#include "Grid.h"
#include "PDE.h"
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <string>
#include <sstream>

class Cell
{
public:
    Cell();
    space avaliable
    bool isFake();
    ~Cell();
private:
    int neighbourList [];
};


#endif	/* _CELL_H */


Lastly, the Grid.cpp file
Code:
#include "Grid.h"
#include "Cell.h"
#include "State.h"
#include "Phenotype.h"
#include "PDE.h"
#include <iostream>
#include <string>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <stdio.h>




using namespace std;


Grid::Grid(int numberOfCells){

	
	cellGrid.resize(numberOfCells^2);


}

void Grid::findNeighbours(int i, int j){
	}


/**
 * \description destructor for the grid
 * \todo figure out destructors
 *
 */
Grid::~Grid(){
    //
}



I have been stuck on this error for days... any help would be so very greatly appreciated!! Thank you in advance.

Reply With Quote
  #2  
Old July 20th, 2010, 01:33 PM
Icon's Avatar
Icon Icon is offline
Command Line Warrior
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Sep 2005
Posts: 1,021 Icon User rank is Private First Class (20 - 50 Reputation Level)Icon User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Weeks 8 h 12 m 36 sec
Reputation Power: 15
Your Cell.h is including Grid.h... This means that you process Grid.h first, before seeing the declaration of Cell. So that is where the error comes from. Cell.h probably should not include Grid.h.
__________________
There is no such thing as C/C++, you either program C or C++

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > "Cell not declared in scope" error but Cell.h included!


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap