Eritey
Eritey

Reputation: 143

Code::Blocks, Unable to locate header file even though its in the same project

Having an issue where as I'm trying to link to a header file and the compiler cannot find it. I normally use VS for C++ development so I'm confused as to why this approach doesn't work in a similar fashion, unless I'm just doing it wrong.

Image of the project including where the constants file is located. http://puu.sh/4oK3K.png

Image of the debug window http://puu.sh/4oKJN.png

Error text:

C:\Users\Chris\Desktop\ECS-master\include\Components\Component.hpp|9|fatal error: include\Constants.hpp: No such file or directory| ||=== Build finished: 1 errors, 0 warnings (0 minutes, 0 seconds) ===|

Upvotes: 2

Views: 12853

Answers (1)

Nicolas Louis Guillemot
Nicolas Louis Guillemot

Reputation: 1638

  1. Always use forward slashes in your #include directives. Backslashes only work on Windows.
  2. The layout of your Code::Blocks project has no effect on your C++ compiler. Go to Code::Blocks' project page and make sure that the folder in which include lies is in your include path. That setting should be in Project->Build Options->Search Directories->Compiler.

Upvotes: 5

Related Questions