By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,965 Members | 2,055 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,965 IT Pros & Developers. It's quick & easy.

Cannot Open #include<...> files Why??

P: n/a
I have 3 files, namely:
dArray.h
dArray.cp
TestdArray.cpp

Problem is when I compile the 'main' program - TestdArray.cpp - , it
(the compiller) produces the following error:

'Unable to open include file 'dArray.h'
'Unable to open include file'dArray.cp'

Obviously, the result is that the compiller doesn't see the variables
declared in
the 'main' program - TestdArray.cpp - and used as an instance of the
class declared and defined in the dArray.h and dArray.cp files and thus
produces other related error messages such as:

'variable_name undeclared (first use in this
function ...)

I don't seem to see any errors though ...

Here is my code in dArray.h ...
////////////////////////////////////////////////////////////////////////////////
#ifndef _MYDYNAM_
#define _MYDYNAM_

class DynamicArray{
public:
DynamicArray(int size=10, int inc=5); //default parameters

int Length(void) const; //length of the array
int Position(void *item) const; //returns the index of an
array as a position of the item whose value is pointed to by *item
void *Nth(int n) const; //will return a an address of the
nth value in the array

void Append(void *item); //adds a value pointed to by
*item

void *Remove(void *item);
void *Remove(int itempos);

private:
void Grow(int amount); //resizes the array dynamically

int fNum; //
int fSize; //the size of array
int fCSize;
int fInc; // size of increment
void **fItem; //

};

#endif
//////////////////////////////////////////////////////////////////////////////////

Here is the part of the code in the header section of dArray.cp ...

#include<stdlib.h>
#include<iostream.h>
#include<assert.h>
#include "dArray.h"

and here is the part of the code in the header section of my main
prog...

#include <iostream.h>
#include<string.h>
#include<stdlib.h>
#include "dArray.h" /* should this go as I have already included it
in the header of dArray.cp file */
#include "dArray.cp"

As I said, I don't think I made an error there as far as the
linking/inclusions of
the .h and .cp files are concerned. however, I keep getting the error
messages I stated above.

Any help please?

Jofio

Apr 11 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Jofio wrote:
I have 3 files, namely:
dArray.h
dArray.cp
TestdArray.cpp

Problem is when I compile the 'main' program - TestdArray.cpp - , it
(the compiller) produces the following error:

'Unable to open include file 'dArray.h'
'Unable to open include file'dArray.cp'

Please don't post the same question twice!

--
Ian Collins.
Apr 11 '06 #2

P: n/a
Ian, my appology for this but I stated that i did this in my reply to
your ealier reply.
thanks

Apr 11 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.