Weird case issue in #include statement

I am a bit new to the forum of course, but I am having a very strange problem. On linux (Ubuntu 8.04, g++ 4.2.4), I have two copies of the exact same file named activematerial.h and activeMaterial.h. For some odd reason,

#include "activematerial.h"

will work, and

#include "activeMaterial.h"

will not, in spite of the existence and equivalence of both of these files. In the latter case, the error messages are entirely indistinguishable from the case in which the inclusion statement is simply commented, i.e. there is no error message stating that the file cannot be found. I have put macro definitions in the files, and the compiler does not even read activeMaterial.h, in spite of no error message. I have other files in this program that follow the exact same convention, without any problems.

I am probably just doing some little thing stupidly, but I have no idea what it might be.

Last edited on
Sounds like g++ is being temperamental. What happens if you rename activematerial.h?
The original post was edited to change the extensions in the second sentence to .h instead of .cpp,

It works now using activematerial.h for whatever reason. If I rename the file, I see the same error messages for various undeclared variables that I would see were I to include activeMaterial.h, in addition to the error about not being able to find the file.
Unix filenames are case sensitive, you must spell the filenames correctly (with the correct case) in C/C++ programs on Unix. Additionally, if you specify a subdirectory, you must use the UNIX directory specification. For example #include <sys/types.h>

Microsoft DOS and Windows are not case sensitive by default and so it's possible to get away with not respecting case or directory separator.
Topic archived. No new replies allowed.