Jump to content

  • Log In with Google      Sign In   
  • Create Account

"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.

  • You cannot reply to this topic
6 replies to this topic

#1 hburd   Members   -  Reputation: 108

Like
0Likes
Like

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.



Sponsor:

#2 Glass_Knife   Moderators   -  Reputation: 4996

Like
5Likes
Like

Posted 12 August 2014 - 03:08 PM

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"
Indie Game Programming

#3 ApochPiQ   Moderators   -  Reputation: 16401

Like
0Likes
Like

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?

#4 hburd   Members   -  Reputation: 108

Like
0Likes
Like

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?



#5 hburd   Members   -  Reputation: 108

Like
0Likes
Like

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.


#6 Ectara   Crossbones+   -  Reputation: 3058

Like
2Likes
Like

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.



#7 hburd   Members   -  Reputation: 108

Like
0Likes
Like

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.



PARTNERS