Why won't a include file get included some times and not other 
Author Message
 Why won't a include file get included some times and not other

I have an include file with the class definition in it and two source files.
One source file has the non-inline definitions in it.  The other file has
the main routine and some testing code.  Both of the source files have what
I believe to be identical #includes to the header file.  The file with the
main routine compiles fine.  The compliation of the other file spits out the

"error: intarray.c(4) : fatal error C1083: Cannot open include file:
'IntArray.h': No such file or directory".

Line 4 is the line with the offending #include directive.  I have even moved
the include file from the Header Files directory to the Source Files
directory with the same result.  Help would be appreciated.

TIA
Marty P.
<insert witty phrase here>



Sat, 12 Nov 2005 07:05:46 GMT  
 Why won't a include file get included some times and not other
Are all the sources in the same place?
If you have different directories for source files and include files,
did you included the files using relative paths?
You should use #include "intarray.h", not #include <intarray.h>.
#include "" searchs the current project path, and #include <> searchs
the paths configured for VC++.
If intarray.cpp and intarray.h are on the same folder, intarray.cpp
should include intarray.h without relative paths.
If you are using pre-compiled headers, the line #include "stdafx.h" must
be the first line in your cpp code.

Quote:

> I have an include file with the class definition in it and two source files.
> One source file has the non-inline definitions in it.  The other file has
> the main routine and some testing code.  Both of the source files have what
> I believe to be identical #includes to the header file.  The file with the
> main routine compiles fine.  The compliation of the other file spits out the

> "error: intarray.c(4) : fatal error C1083: Cannot open include file:
> 'IntArray.h': No such file or directory".

> Line 4 is the line with the offending #include directive.  I have even moved
> the include file from the Header Files directory to the Source Files
> directory with the same result.  Help would be appreciated.

> TIA
> Marty P.
> <insert witty phrase here>

--
Ravi Ambros Wallau


Remove the "nospam." from the last line and you'll have my E-Mail.



Sat, 12 Nov 2005 09:12:16 GMT  
 Why won't a include file get included some times and not other



Quote:
> Are all the sources in the same place?

    Yes, they are in the "Source Files" directory provided by default in a
C++ Project.

Quote:
> If you have different directories for source files and include files,
> did you included the files using relative paths?

No, I have put them without a relative path and don't think I have to as one
of the .cpp files works and one of them does not.

Quote:
> You should use #include "intarray.h", not #include <intarray.h>.
> #include "" searches the current project path, and #include <> searches
> the paths configured for VC++.

I have tried with the .h in the same directory as the .cpp files and the .h
file in the Headers file directory with the same result: one .cpp file works
and one doesn't

Quote:
> If intarray.cpp and intarray.h are on the same folder, intarray.cpp
> should include intarray.h without relative paths.

tried it, still didn't work.

Quote:
> If you are using pre-compiled headers, the line #include "stdafx.h" must
> be the first line in your cpp code.

As far as I know I am not using precompiled headers.

Here's what I believe to be the relevant source code:
============ Start of code
#include <assert.h>
#include <iostream.h>

#include "IntArray.h"
=========== End of code

These are the first several lines of code in both main.cpp and IntArray.cpp.
main.cpp compiles without errors and IntArray.cpp says it can't find
IntArray.h. IntArray.cpp and main.cpp are in the same directory.  I've tried
with IntArray.h both in the same directories as the source files and in the
Header Files directory.  I have tried both double quotes and angle brackets
(<>) around the include file name, both work for main.cpp and both don't
work for IntArray.cpp.

Quote:

> > I have an include file with the class definition in it and two source
files.
> > One source file has the non-inline definitions in it.  The other file
has
> > the main routine and some testing code.  Both of the source files have
what
> > I believe to be identical #includes to the header file.  The file with
the
> > main routine compiles fine.  The compliation of the other file spits out
the

> > "error: intarray.c(4) : fatal error C1083: Cannot open include file:
> > 'IntArray.h': No such file or directory".

> > Line 4 is the line with the offending #include directive.  I have even
moved
> > the include file from the Header Files directory to the Source Files
> > directory with the same result.  Help would be appreciated.

> > TIA
> > Marty P.
> > <insert witty phrase here>

> --
> Ravi Ambros Wallau


> Remove the "nospam." from the last line and you'll have my E-Mail.



Sat, 12 Nov 2005 19:25:46 GMT  
 Why won't a include file get included some times and not other

Quote:



> > Are all the sources in the same place?
>     Yes, they are in the "Source Files" directory provided by default in a
> C++ Project.

> > If you have different directories for source files and include files,
> > did you included the files using relative paths?
> No, I have put them without a relative path and don't think I have to as
one
> of the .cpp files works and one of them does not.

> > You should use #include "intarray.h", not #include <intarray.h>.
> > #include "" searches the current project path, and #include <> searches
> > the paths configured for VC++.
> I have tried with the .h in the same directory as the .cpp files and the
.h
> file in the Headers file directory with the same result: one .cpp file
works
> and one doesn't

> > If intarray.cpp and intarray.h are on the same folder, intarray.cpp
> > should include intarray.h without relative paths.
> tried it, still didn't work.

> > If you are using pre-compiled headers, the line #include "stdafx.h" must
> > be the first line in your cpp code.
> As far as I know I am not using precompiled headers.

> Here's what I believe to be the relevant source code:
> ============ Start of code
> #include <assert.h>
> #include <iostream.h>

> #include "IntArray.h"
> =========== End of code

> These are the first several lines of code in both main.cpp and
IntArray.cpp.
> main.cpp compiles without errors and IntArray.cpp says it can't find
> IntArray.h. IntArray.cpp and main.cpp are in the same directory.  I've
tried
> with IntArray.h both in the same directories as the source files and in
the
> Header Files directory.  I have tried both double quotes and angle
brackets
> (<>) around the include file name, both work for main.cpp and both don't
> work for IntArray.cpp.


> > > I have an include file with the class definition in it and two source
> files.
> > > One source file has the non-inline definitions in it.  The other file
> has
> > > the main routine and some testing code.  Both of the source files have
> what
> > > I believe to be identical #includes to the header file.  The file with
> the
> > > main routine compiles fine.  The compliation of the other file spits
out
> the

> > > "error: intarray.c(4) : fatal error C1083: Cannot open include file:
> > > 'IntArray.h': No such file or directory".

Your error message says "intarray.c", not "intarray.cpp". Is that the issue
(looking at the wrong file)?

Jay



Sun, 13 Nov 2005 01:12:56 GMT  
 Why won't a include file get included some times and not other


Quote:




> > > Are all the sources in the same place?
> >     Yes, they are in the "Source Files" directory provided by default in
a
> > C++ Project.

> > > If you have different directories for source files and include files,
> > > did you included the files using relative paths?
> > No, I have put them without a relative path and don't think I have to as
> one
> > of the .cpp files works and one of them does not.

> > > You should use #include "intarray.h", not #include <intarray.h>.
> > > #include "" searches the current project path, and #include <>
searches
> > > the paths configured for VC++.
> > I have tried with the .h in the same directory as the .cpp files and the
> .h
> > file in the Headers file directory with the same result: one .cpp file
> works
> > and one doesn't

> > > If intarray.cpp and intarray.h are on the same folder, intarray.cpp
> > > should include intarray.h without relative paths.
> > tried it, still didn't work.

> > > If you are using pre-compiled headers, the line #include "stdafx.h"
must
> > > be the first line in your cpp code.
> > As far as I know I am not using precompiled headers.

> > Here's what I believe to be the relevant source code:
> > ============ Start of code
> > #include <assert.h>
> > #include <iostream.h>

> > #include "IntArray.h"
> > =========== End of code

> > These are the first several lines of code in both main.cpp and
> IntArray.cpp.
> > main.cpp compiles without errors and IntArray.cpp says it can't find
> > IntArray.h. IntArray.cpp and main.cpp are in the same directory.  I've
> tried
> > with IntArray.h both in the same directories as the source files and in
> the
> > Header Files directory.  I have tried both double quotes and angle
> brackets
> > (<>) around the include file name, both work for main.cpp and both don't
> > work for IntArray.cpp.


> > > > I have an include file with the class definition in it and two
source
> > files.
> > > > One source file has the non-inline definitions in it.  The other
file
> > has
> > > > the main routine and some testing code.  Both of the source files
have
> > what
> > > > I believe to be identical #includes to the header file.  The file
with
> > the
> > > > main routine compiles fine.  The compliation of the other file spits
> out
> > the

> > > > "error: intarray.c(4) : fatal error C1083: Cannot open include file:
> > > > 'IntArray.h': No such file or directory".

> Your error message says "intarray.c", not "intarray.cpp". Is that the
issue
> (looking at the wrong file)?

> Jay

Unfortunately that wasn't the problem.  I saw that too after the last post,
but using the .cpp file didn't help.


Mon, 14 Nov 2005 00:27:54 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Simple project won't compile (included several times)

2. string table not getting included from lib file

3. why not include .c files ?

4. why no error occur although i didn't include header file

5. fatal error C1083: Cannot open include file: 'excpt.h': No such file or directory

6. Missing includes in /usr/include/linux/*.h and /usr/include/asm.h

7. Newbie - Compile error (Cannot open include file: 'xmldom.idl': No such file or directory)

8. Compiler won't search the INCLUDE environment variable

9. Compiler won't search the INCLUDE environment variable

10. Compiler won't search the INCLUDE environment variable

11. include file of includes

12. source for included included files

 

 
Powered by phpBB® Forum Software