Include problems...

This is a discussion on Include problems... within the C++ Programming forums, part of the General Programming Boards category; The problem is that Im making this console application, and I have this header file (that i wrote myself) and ...

  1. #1
    Registered User Finchie_88's Avatar
    Join Date
    Aug 2004
    Posts
    154

    Question Include problems...

    The problem is that Im making this console application, and I have this header file (that i wrote myself) and for some reason, when I try to compile it doesn't work. Ive put in "#include "shortcolours.h", but for some reason, it keeps on saying "no file or directory found", I understand the error, but I dont know how to get round it

  2. #2
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,807
    Well is it in the directory that your source file is in?
    You could put it in the include directory of your compiler but usually thats not the coolest thing to do
    Woop?

  3. #3
    Registered User
    Join Date
    Oct 2004
    Posts
    120
    It either has to be in the source directory being compiled or the include search path for the compiler must be modified to look in the directory your file is in.

    Every compiler allows you to specify additional search directories (it already searches its "standard" include paths containing all the c/c++ header files you are used to including, like stdio and stuff. So find out how to make your compiler look in additional places (compiler switch).

    Another option is to put the path of the file in the #include directive. Not always the best solution, but it works just fine for small projects. The paths should be relative though, like #include "../../include/myFile.h" instead of absolute so you can move the source around.

    PK

  4. #4
    Registered User Finchie_88's Avatar
    Join Date
    Aug 2004
    Posts
    154
    Yer, its in the directory of the main cpp file and the project file, but errors all the way

  5. #5
    Registered User
    Join Date
    Oct 2004
    Posts
    120
    Always double check the spelling...I've got many lumps on my head for reading what I wanted to see and not what I actually typed...

  6. #6
    Registered User Finchie_88's Avatar
    Join Date
    Aug 2004
    Posts
    154
    Problem solved, thats for the help

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C programing doubt
    By sivasankari in forum C Programming
    Replies: 2
    Last Post: 04-29-2008, 09:19 AM
  2. some problems with #include
    By Cmaniac in forum C Programming
    Replies: 6
    Last Post: 04-15-2007, 11:28 PM
  3. Headers that use each other
    By nickname_changed in forum C++ Programming
    Replies: 7
    Last Post: 10-03-2003, 04:25 AM
  4. #Include "class" problems
    By Unregistered in forum C++ Programming
    Replies: 17
    Last Post: 11-26-2001, 09:40 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21