Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. header file

header file

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutorialquestion
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    khomeyni
    wrote on last edited by
    #1

    hello everybody when i include a header file with space between words of its name then my compiler cannot link them and take error: [sajad@sajad binary search trees]$ g++ binary\ trees.cpp binary trees.cpp:3:73: error: /home/sajad/src/ds/test/binary\ search\ trees/BST_node_base.h: No such file or directory binary trees.cpp:4:63: error: /home/sajad/src/ds/test/binary\ search\ trees/BST.h: No such file or direct while the directory and address is completely true. #include<iostream> #include "/home/sajad/src/ds/test/binary\ search\ trees/BST_node_base.h" #include "/home/sajad/src/ds/test/binary\ search\ trees/BST.h" but when i change the name ,without space between it then it run correct,what can i do to solve this error? also when i include a fileheader and in it use for example cout<<"hello"< using namespace std it work true.does it must be as i write or there is another way to solve this? this is the part of header file: #include<iostream> using namespace std; template <class T>class BS_Tree{ public: bool direction; int n; BST_node<T>* root; BS_Tree(){ root=NULL; } ....

    C CPalliniC S 3 Replies Last reply
    0
    • K khomeyni

      hello everybody when i include a header file with space between words of its name then my compiler cannot link them and take error: [sajad@sajad binary search trees]$ g++ binary\ trees.cpp binary trees.cpp:3:73: error: /home/sajad/src/ds/test/binary\ search\ trees/BST_node_base.h: No such file or directory binary trees.cpp:4:63: error: /home/sajad/src/ds/test/binary\ search\ trees/BST.h: No such file or direct while the directory and address is completely true. #include<iostream> #include "/home/sajad/src/ds/test/binary\ search\ trees/BST_node_base.h" #include "/home/sajad/src/ds/test/binary\ search\ trees/BST.h" but when i change the name ,without space between it then it run correct,what can i do to solve this error? also when i include a fileheader and in it use for example cout<<"hello"< using namespace std it work true.does it must be as i write or there is another way to solve this? this is the part of header file: #include<iostream> using namespace std; template <class T>class BS_Tree{ public: bool direction; int n; BST_node<T>* root; BS_Tree(){ root=NULL; } ....

      C Offline
      C Offline
      Chris Losinger
      wrote on last edited by
      #2

      khomeyni wrote:

      what can i do to solve this error?

      what error ? why would you put spaces between the parts of the path ?

      image processing toolkits | batch image processing

      1 Reply Last reply
      0
      • K khomeyni

        hello everybody when i include a header file with space between words of its name then my compiler cannot link them and take error: [sajad@sajad binary search trees]$ g++ binary\ trees.cpp binary trees.cpp:3:73: error: /home/sajad/src/ds/test/binary\ search\ trees/BST_node_base.h: No such file or directory binary trees.cpp:4:63: error: /home/sajad/src/ds/test/binary\ search\ trees/BST.h: No such file or direct while the directory and address is completely true. #include<iostream> #include "/home/sajad/src/ds/test/binary\ search\ trees/BST_node_base.h" #include "/home/sajad/src/ds/test/binary\ search\ trees/BST.h" but when i change the name ,without space between it then it run correct,what can i do to solve this error? also when i include a fileheader and in it use for example cout<<"hello"< using namespace std it work true.does it must be as i write or there is another way to solve this? this is the part of header file: #include<iostream> using namespace std; template <class T>class BS_Tree{ public: bool direction; int n; BST_node<T>* root; BS_Tree(){ root=NULL; } ....

        CPalliniC Offline
        CPalliniC Offline
        CPallini
        wrote on last edited by
        #3

        You may either avoid spaces inside the paths or use relative ones. As about the namespace, You have two options:

        • specify, as you did, using namespace std;
        • Qualify each (std) object with the std namespace, e.g. std::cout instead of cout, std::endl instead of endl etc...

        :)

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
        [My articles]

        In testa che avete, signor di Ceprano?

        1 Reply Last reply
        0
        • K khomeyni

          hello everybody when i include a header file with space between words of its name then my compiler cannot link them and take error: [sajad@sajad binary search trees]$ g++ binary\ trees.cpp binary trees.cpp:3:73: error: /home/sajad/src/ds/test/binary\ search\ trees/BST_node_base.h: No such file or directory binary trees.cpp:4:63: error: /home/sajad/src/ds/test/binary\ search\ trees/BST.h: No such file or direct while the directory and address is completely true. #include<iostream> #include "/home/sajad/src/ds/test/binary\ search\ trees/BST_node_base.h" #include "/home/sajad/src/ds/test/binary\ search\ trees/BST.h" but when i change the name ,without space between it then it run correct,what can i do to solve this error? also when i include a fileheader and in it use for example cout<<"hello"< using namespace std it work true.does it must be as i write or there is another way to solve this? this is the part of header file: #include<iostream> using namespace std; template <class T>class BS_Tree{ public: bool direction; int n; BST_node<T>* root; BS_Tree(){ root=NULL; } ....

          S Offline
          S Offline
          Stuart Dootson
          wrote on last edited by
          #4

          Take out the back-slashes that quote the spaces. That is, change this:

          #include "/home/sajad/src/ds/test/binary\ search\ trees/BST_node_base.h"
          #include "/home/sajad/src/ds/test/binary\ search\ trees/BST.h"

          to this

          #include "/home/sajad/src/ds/test/binary search trees/BST_node_base.h"
          #include "/home/sajad/src/ds/test/binary search trees/BST.h"

          Oh - but don't, don't, don't use absolute paths in code like that! What happens when the code-base moves? You're screwed, aren't you.

          Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p MVP for 2010 - who'd'a thunk it!

          K 1 Reply Last reply
          0
          • S Stuart Dootson

            Take out the back-slashes that quote the spaces. That is, change this:

            #include "/home/sajad/src/ds/test/binary\ search\ trees/BST_node_base.h"
            #include "/home/sajad/src/ds/test/binary\ search\ trees/BST.h"

            to this

            #include "/home/sajad/src/ds/test/binary search trees/BST_node_base.h"
            #include "/home/sajad/src/ds/test/binary search trees/BST.h"

            Oh - but don't, don't, don't use absolute paths in code like that! What happens when the code-base moves? You're screwed, aren't you.

            Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p MVP for 2010 - who'd'a thunk it!

            K Offline
            K Offline
            khomeyni
            wrote on last edited by
            #5

            Stuart Dootson wrote:

            Oh - but don't, don't, don't use absolute paths in code like that! What happens when the code-base moves? You're screwed, aren't you

            ok i will do it,i have changed it to :

            Stuart Dootson wrote:

            #include "/home/sajad/src/ds/test/binary search trees/BST_node_base.h" #include "/home/sajad/src/ds/test/binary search trees/BST.h

            and solve my problem. thnx for all answers.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups