• FEATURED
• FEATURED
• FEATURED
• FEATURED
• FEATURED

View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# "No such file or directory" but it's obviously there!

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

6 replies to this topic

### #1hburd  Members

Posted 12 August 2014 - 02:43 PM

I'm trying to include my vector class

#include "math/Vec2.h"


and Vec2.h is obviously in the math directory.

I have no idea how this is happening, but when I try to compile I get "math/Vec2.h: no such file or directory"

I have another file in the math directory called "Mat3x3.h" which I can include just fine:

#include "math/Mat3x3.h"    //no problem


What could I possibly be doing wrong? Obviously I've double checked the filename for any typos.

### #2Glass_Knife  Moderators

Posted 12 August 2014 - 03:08 PM

POPULAR

These things are so common, you'd think all these issues would be worked out.  But we need a little more info:

OS

Compiler/IDE

Off the top of my head, either you think that the math/Vec2.h file has been added to the include path but it has not, or you've moved from windows where file names are case insensitive to Linux where case matters.

If it makes you feel any better, I've been coding since the 90s and I just spent two days trying to get my windows C++ compiler to link some SFML static libraries.  That actually doesn't make me feel any better.

Edited by Glass_Knife, 12 August 2014 - 03:09 PM.

I think, therefore I am. I think? - "George Carlin"
My Website: Indie Game Programming

My Book: http://amzn.com/1305076532

### #3ApochPiQ  Moderators

Posted 12 August 2014 - 03:33 PM

Are you trying to include Vec2.h and Mat3x3.h from the same .c or .cpp file? Or is it one file using Vec2.h and another file using Mat3x3.h?
Wielder of the Sacred Wands

### #4hburd  Members

Posted 12 August 2014 - 03:33 PM

OS is linux, compiler is g++. But I just tried adding -I . to the compile command and now the problem's gone.

Now the real question is, why was #include "math/Mat3x3.h" working before I did this? But moreover, why do I even have to add -I . to the compile command? Isn't the current directory searched in by default when using quotations instead of angle brackets?

### #5hburd  Members

Posted 12 August 2014 - 03:39 PM

Are you trying to include Vec2.h and Mat3x3.h from the same .c or .cpp file? Or is it one file using Vec2.h and another file using Mat3x3.h?

They're included in a couple of files, all of which include both.

Edit: with the exception of Mat3x3, which only includes Vec2.

Edited by hburd, 12 August 2014 - 03:41 PM.

### #6Ectara  Members

Posted 12 August 2014 - 04:01 PM

They're included in a couple of files, all of which include both.

Edit: with the exception of Mat3x3, which only includes Vec2.

Don't forget that the paths are relative to the file being included, not the current working directory of the build process, so be sure to double-check your paths; if the path is specified wrong, it may attempt to check the path relative to the paths in your include path environment variables or commandline switches. This would cause it to work with the -I switch, but not otherwise, if this is the problem.

### #7hburd  Members

Posted 12 August 2014 - 05:59 PM

Yeah, I guess that would have been the problem. So the error would have been coming from the Mat3x3 I included instead of the Vec2. I didn't think of that.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.