Thread: Header File Question (Paths and no paths)

  1. #1
    Registered User
    Join Date
    Jan 2010
    Posts
    233

    Question Header File Question (Paths and no paths)

    Hi there,

    I notice in the project I'm working on has one file (a .cpp file) where a specific path is written for a header file like so:

    Code:
    #include "../Needed Files/Common/d3dApp.h"
    #include "../Needed Files/Common/MathHelper.h"
    #include "../Needed Files/Common/UploadBuffer.h"
    However..it is the only one in the project that does. None of the other files have paths to them they just look like this:

    Code:
    #include "d3dApp.h"
    And that's right throughout the project (including other .cpp files). If I try and change the path in the main .cpp file to for example this:

    Code:
    #include "d3dApp.h"
    #include "MathHelper.h"
    #include "UploadBuffer.h"
    it fails. So I was curious as to why one file requires a written path and others don't. Even other .cpp files don't.

    Is it a project setting or something or does the compiler for whatever require at least one file to have specific paths?

    Thanks

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,675
    Yes, the list of include search paths is part of the project.

    Normally, this is a project wide setting common to all the files.

    But maybe someone fat-fingered main.cpp include paths to break it.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Jan 2010
    Posts
    233
    Ok I'll go have a look and see if I can fix this in the project settings directory thanks

  4. #4
    Registered User
    Join Date
    Jan 2010
    Posts
    233

    Post Success (this time)

    I altered the project settings and that problem went away. For the benefit of others here's where I changed the setting and added the header file directory to the project:

    Header File Question (Paths and no paths)-include-jpg

    Thanks

    p.s. the field in bold is the one, not the blue selected one.

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,675
    You'll need to do the same for the Release build in the configuration drop-down box.

    Otherwise it's going to break again when you do a release build.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  6. #6
    Registered User
    Join Date
    Jan 2010
    Posts
    233
    -Done! Thank you Salem

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Windows file paths.
    By redruby147 in forum C Programming
    Replies: 14
    Last Post: 08-14-2009, 09:00 PM
  2. File Paths and functions
    By zidsal in forum C Programming
    Replies: 3
    Last Post: 11-23-2008, 03:35 PM
  3. Getting opened file paths
    By geek@02 in forum Windows Programming
    Replies: 6
    Last Post: 09-18-2005, 06:53 PM
  4. using relative file paths..?
    By anomaly in forum C++ Programming
    Replies: 2
    Last Post: 11-25-2003, 03:36 PM
  5. Newbie Question: File Input and Relative Paths
    By Ashes999 in forum C++ Programming
    Replies: 11
    Last Post: 05-23-2003, 04:21 AM

Tags for this Thread