New style header files?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Protoman

    #1

    New style header files?

    I have this file: example.hpp
    Will Dev-Cpp (or any other compiler) accept this?: #include "cexample"
    Thanks!!!

  • W Marsh

    #2
    Re: New style header files?

    On 3 Dec 2005 13:45:29 -0800, "Protoman" <Protoman2050@g mail.com>
    wrote:
    [color=blue]
    >I have this file: example.hpp
    >Will Dev-Cpp (or any other compiler) accept this?: #include "cexample"
    >Thanks!!![/color]

    If the file cexample exists! What does example.hpp have to do with it?

    #include does exactly what it says on the tin.

    Comment

    • Andre Kostur

      #3
      Re: New style header files?

      W Marsh <wayneDOTmarshA TgmailDOTcom@> wrote in
      news:9n44p19vj1 3k74ofk0c8bogfp g5jldmnef@4ax.c om:
      [color=blue]
      > On 3 Dec 2005 13:45:29 -0800, "Protoman" <Protoman2050@g mail.com>
      > wrote:
      >[color=green]
      >>I have this file: example.hpp
      >>Will Dev-Cpp (or any other compiler) accept this?: #include "cexample"
      >>Thanks!!![/color]
      >
      > If the file cexample exists! What does example.hpp have to do with it?
      >
      > #include does exactly what it says on the tin.
      >[/color]

      The OP is probably getting confused with what:
      #include <string.h>
      and
      #include <cstring>

      Have to do with each other, and does it apply to user-supplied include
      files (such as example.hpp).

      Answer is... no, if you don't supply a file extension on the #include
      statment, the compiler (or at least no compiler that I am aware of) will
      not automatically add _anything_ to the filename. It will attempt to
      include exactly the name you specified.

      Comment

      • Protoman

        #4
        Re: New style header files?


        Andre Kostur wrote:[color=blue]
        > W Marsh <wayneDOTmarshA TgmailDOTcom@> wrote in
        > news:9n44p19vj1 3k74ofk0c8bogfp g5jldmnef@4ax.c om:
        >[color=green]
        > > On 3 Dec 2005 13:45:29 -0800, "Protoman" <Protoman2050@g mail.com>
        > > wrote:
        > >[color=darkred]
        > >>I have this file: example.hpp
        > >>Will Dev-Cpp (or any other compiler) accept this?: #include "cexample"
        > >>Thanks!!![/color]
        > >
        > > If the file cexample exists! What does example.hpp have to do with it?
        > >
        > > #include does exactly what it says on the tin.
        > >[/color]
        >
        > The OP is probably getting confused with what:
        > #include <string.h>
        > and
        > #include <cstring>
        >
        > Have to do with each other, and does it apply to user-supplied include
        > files (such as example.hpp).
        >
        > Answer is... no, if you don't supply a file extension on the #include
        > statment, the compiler (or at least no compiler that I am aware of) will
        > not automatically add _anything_ to the filename. It will attempt to
        > include exactly the name you specified.[/color]

        Then can I name the file "cexample"? and it'll work?

        Comment

        • Rolf Magnus

          #5
          Re: New style header files?

          Protoman wrote:
          [color=blue][color=green]
          >> The OP is probably getting confused with what:
          >> #include <string.h>
          >> and
          >> #include <cstring>
          >>
          >> Have to do with each other, and does it apply to user-supplied include
          >> files (such as example.hpp).
          >>
          >> Answer is... no, if you don't supply a file extension on the #include
          >> statment, the compiler (or at least no compiler that I am aware of) will
          >> not automatically add _anything_ to the filename. It will attempt to
          >> include exactly the name you specified.[/color]
          >
          > Then can I name the file "cexample"? and it'll work?[/color]

          Yes.

          Comment

          • BobR

            #6
            Re: New style header files?


            Protoman wrote in message
            <1133657135.460 215.16030@g49g2 000cwa.googlegr oups.com>...[color=blue]
            >
            >Then can I name the file "cexample"? and it'll work?[/color]

            Did you try it?
            (BTW: sex is spelled s e x, not c e x.)

            You can name the file "myfunkybutt.so meslinkyextensi on" and do:
            #include "myfunkybutt.so meslinkyextensi on"

            Dev-C++ uses the MinGW port of GCC. Read the GCC docs to see which file
            extensions have special meaning.
            Look in the '*\include' directory for the 'C' headers.
            Look in the '*\include\c++\ <ver. number (3.3.1)>" for the 'C++' headers.
            Go to the C++ includes directory and open the "cstring' header, you'll see
            it refer to the 'string.h' C header, and do some stuff to make it work in C++
            (if needed).

            --
            Bob R
            POVrookie


            Comment

            • Andre Kostur

              #7
              Re: New style header files?

              "Protoman" <Protoman2050@g mail.com> wrote in
              news:1133657135 .460215.16030@g 49g2000cwa.goog legroups.com:
              [color=blue]
              >
              > Andre Kostur wrote:[color=green]
              >> W Marsh <wayneDOTmarshA TgmailDOTcom@> wrote in
              >> news:9n44p19vj1 3k74ofk0c8bogfp g5jldmnef@4ax.c om:
              >>[color=darkred]
              >> > On 3 Dec 2005 13:45:29 -0800, "Protoman" <Protoman2050@g mail.com>
              >> > wrote:
              >> >
              >> >>I have this file: example.hpp
              >> >>Will Dev-Cpp (or any other compiler) accept this?: #include
              >> >>"cexample" Thanks!!!
              >> >
              >> > If the file cexample exists! What does example.hpp have to do with
              >> > it?
              >> >
              >> > #include does exactly what it says on the tin.
              >> >[/color]
              >>
              >> The OP is probably getting confused with what:
              >> #include <string.h>
              >> and
              >> #include <cstring>
              >>
              >> Have to do with each other, and does it apply to user-supplied
              >> include files (such as example.hpp).
              >>
              >> Answer is... no, if you don't supply a file extension on the #include
              >> statment, the compiler (or at least no compiler that I am aware of)
              >> will not automatically add _anything_ to the filename. It will
              >> attempt to include exactly the name you specified.[/color]
              >
              > Then can I name the file "cexample"? and it'll work?
              >[/color]

              Yes, but I'd wonder why you'd want to have an extensionless file....
              it's generally handy to konw if a source file is intended to be used as
              a header file or not..

              Comment

              Working...