# Class problems

## Recommended Posts

Been Trawling the internet for hours and still can't solve the problem. I've decided to seperate all my headers into .h and .cpp as I understand this is the norm. (Before all the code was in just .h) Everytime I compile the below code I get the following error;
error C2065: 'imageData' : undeclared identifier


I've tried using extern (although im not totally sure how to use it-any help?) manage_image.h
#ifndef MANAGE_IMAGE_H
#define MANAGE_IMAGE_H

#include <vector>
#include <string>
#include "image.h"

class manage_image
{
private:
std::vector<image*> imageData;

public:
manage_image(void);
~manage_image(void){};

};


manage_image.cpp
#include "manage_image.h"

#include "image.h"
#include <vector>

manage_image::manage_image(void)
{
}

{
int returnID = imageData.size();

return returnID;
}
{
return imageData[getID]->GetPointer();

}


Can anybody help point out the problem and how to solve it. Thanks. Darren PS Sorry about that seemed to have posted in the game programming forum instead of general programming

##### Share on other sites
In the CPP file, the compiler doesn't know that it is part of manage_image.h, just that you include it.

The manage_image:: tells the compiler that addImage is part of the included manage_image class.

##### Share on other sites
Oh my.

I really dont know how I did that, think ill go have a little rest.

Thanks for that. haha

##### Share on other sites
If you haven't read this article yet, then give it a look. I think you'll find it usefull.

## Create an account

Register a new account

• ## Partner Spotlight

• ### Forum Statistics

• Total Topics
627637
• Total Posts
2978335

• 10
• 12
• 22
• 13
• 33