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
help
17 Posts 7 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.
  • M mpapeo

    I am running an application on windows from a unix machine and it was looking for this header but then i didn't want to go to the unix machine -oam-

    C Offline
    C Offline
    Christian Graus
    wrote on last edited by
    #8

    OK - as I thought. You're more than a little lost here. A header file describes functionality that needs to be provided either in matching .cpp files, or in a library file. The compiler is asking for the header file now, but if you provide it, you will get linker errors from here to sundown, because you will have a file that promises the compiler that you'll tell it how to impliment functions you're describing now, sometime later. You will not meet that promise, and so your code will still not work ( unless this is an inline class that's all in the .h file, implimentation as well as interface, but that seems unlikely ). Christian I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer

    M D 2 Replies Last reply
    0
    • Q qcha0s

      Are you developing on UNIX? .. I Tlooks like it's a UNIX specific header file see: [^] for my google results... I also found this http://aegis.sourceforge.net/doxygen-html/unistd_8h-source.html[^] which is *A* uninstd.h file .. but i have doubts that it's the one specific to the application you are trying to compile .... IF you can provide details about the application / source / where it was obtained from / what platform your working on etc... I will do my bes to help you out ... Regards qcha0s

      M Offline
      M Offline
      mpapeo
      wrote on last edited by
      #9

      infact i wanted to compile this code below but now i am working hand in hand with unix machines. But now i wanted to try this application on windows #include /* has definitions of printf, fprintf, fopen, fscanf, fclose, fflush, perror, rename and BUFSIZ */ #include /* has definitions of getenv and exit */ #include /* has definition of sleep */ #include /* has definitions of strcpy and strcat */ main() { char *restart_name, *restart, old_restart_name[BUFSIZ]; FILE *restart_file; int n; /* Is this a continued job or a new one? */ if (! (restart = getenv ("RSAVE_RESTART"))) { printf ("Starting a new run.\n"); n = 0; } else { if (! (restart_name = getenv ("RSAVE_CHECKFILE"))) { fprintf (stderr, "error: no checkpoint file for the restart job\n"); exit (1); } else { printf ("Restarting the job from %s.\n", restart_name); if (! (restart_file = fopen(restart_name, "r"))) { perror (restart_name); exit (2); } else { if (! (fscanf (restart_file, "%d", &n) > 0)) { fprintf (stderr, "%s: input file format error\n", restart_name); exit (3); } else { fclose (restart_file); } } } } printf ("n = %d\n", n); printf ("\tcomputing ... "); fflush (stdout); sleep (5); n++; printf ("done.\n"); printf ("n = %d\n", n); if (! (restart_name = getenv ("RSAVE_CHECKFILE"))) { printf ("checkpointing not requested, exiting...\n"); exit (0); } else { if (restart) { strcpy (old_restart_name, restart_name); strcat (old_restart_name, ".old"); printf ("renaming old restart file to %s\n", old_restart_name); if (0 > rename (restart_name, old_restart_name)) { perror (old_restart_name); exit (4); } } printf ("saving data on %s\n", restart_name); if (! (restart_file = fopen (restart_name, "w"))) { perror (restart_name); exit (5); } else { fprintf (restart_file, "%d\n", n); fclose (restart_file); } } exit (0); } -oam-

      1 Reply Last reply
      0
      • C Christian Graus

        OK - as I thought. You're more than a little lost here. A header file describes functionality that needs to be provided either in matching .cpp files, or in a library file. The compiler is asking for the header file now, but if you provide it, you will get linker errors from here to sundown, because you will have a file that promises the compiler that you'll tell it how to impliment functions you're describing now, sometime later. You will not meet that promise, and so your code will still not work ( unless this is an inline class that's all in the .h file, implimentation as well as interface, but that seems unlikely ). Christian I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer

        M Offline
        M Offline
        mpapeo
        wrote on last edited by
        #10

        Did you check the code i sent there headers are #include /* has definitions of printf, fprintf, fopen, fscanf, fclose, fflush, perror, rename and BUFSIZ */ #include /* has definitions of getenv and exit */ #include /* has definition of sleep */ #include /* has definitions of strcpy and strcat */ therefore i thought the header file will take care of the definition of sleep and that there header file is standard like some headers files that you can get them from somewhere and use them -oam-

        C N T 3 Replies Last reply
        0
        • M mpapeo

          Did you check the code i sent there headers are #include /* has definitions of printf, fprintf, fopen, fscanf, fclose, fflush, perror, rename and BUFSIZ */ #include /* has definitions of getenv and exit */ #include /* has definition of sleep */ #include /* has definitions of strcpy and strcat */ therefore i thought the header file will take care of the definition of sleep and that there header file is standard like some headers files that you can get them from somewhere and use them -oam-

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #11

          mpapeo wrote: Did you check the code i sent there No, you need to check 'Do not treat <'s as HTML tags' so I can see this code, for what it's worth mpapeo wrote: therefore i thought the header file will take care of the definition of sleep It will take care of the 'definition', that is, it will define the interface, the functions/structs/classes provided elsewhere. It won't give you the code you need to make those things work. The standard library headers, such as iostream, define exactly that, and have corresponding .cpp files which are in directories that your compiler includes in it's searches by default. So they get compiled and linked into your project, no problem. You can't just add other header files to do the same thing, without making sure you are linking to a library, or have the implimentation files available to the compiler also. Christian I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer

          1 Reply Last reply
          0
          • M mpapeo

            Did you check the code i sent there headers are #include /* has definitions of printf, fprintf, fopen, fscanf, fclose, fflush, perror, rename and BUFSIZ */ #include /* has definitions of getenv and exit */ #include /* has definition of sleep */ #include /* has definitions of strcpy and strcat */ therefore i thought the header file will take care of the definition of sleep and that there header file is standard like some headers files that you can get them from somewhere and use them -oam-

            N Offline
            N Offline
            NewbieStats
            wrote on last edited by
            #12

            Are you just looking for a header file that will support Sleep? /* Just a Human Trying to Live in a Computers World. */

            1 Reply Last reply
            0
            • C Christian Graus

              OK - as I thought. You're more than a little lost here. A header file describes functionality that needs to be provided either in matching .cpp files, or in a library file. The compiler is asking for the header file now, but if you provide it, you will get linker errors from here to sundown, because you will have a file that promises the compiler that you'll tell it how to impliment functions you're describing now, sometime later. You will not meet that promise, and so your code will still not work ( unless this is an inline class that's all in the .h file, implimentation as well as interface, but that seems unlikely ). Christian I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #13

              Christian Graus wrote: A header file describes functionality that needs to be provided either in matching .cpp files, or in a library file. True, but not always. Some of them have typedef and struct declarations only. I've no idea what mpapeo is looking for, however.


              "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

              C 1 Reply Last reply
              0
              • D David Crow

                Christian Graus wrote: A header file describes functionality that needs to be provided either in matching .cpp files, or in a library file. True, but not always. Some of them have typedef and struct declarations only. I've no idea what mpapeo is looking for, however.


                "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                C Offline
                C Offline
                Christian Graus
                wrote on last edited by
                #14

                DavidCrow wrote: Some of them have typedef and struct declarations only Yeah, and some contain the entire class ( can't they ? ). I said as much before, but in restating it, I was less careful :-) Christian I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer

                1 Reply Last reply
                0
                • M mpapeo

                  Did you check the code i sent there headers are #include /* has definitions of printf, fprintf, fopen, fscanf, fclose, fflush, perror, rename and BUFSIZ */ #include /* has definitions of getenv and exit */ #include /* has definition of sleep */ #include /* has definitions of strcpy and strcat */ therefore i thought the header file will take care of the definition of sleep and that there header file is standard like some headers files that you can get them from somewhere and use them -oam-

                  T Offline
                  T Offline
                  ThatsAlok
                  wrote on last edited by
                  #15

                  My collegue have ported some Project from Unix enviornment to windows enviornment. Here is What i found in unistd.h

                  /*
                  * This file is part of the Mingw32 package.
                  *
                  * unistd.h maps (roughly) to io.h
                  */

                  #ifndef _UNISTD_H
                  #define _UNISTD_H

                  #include <io.h>
                  #include <process.h>

                  #endif /* _UNISTD_H */


                  [Vote One Here, Complete my Survey....] Alok Gupta
                  visit me at http://www.thisisalok.tk          "I Think Believe this Will Help"

                  M 1 Reply Last reply
                  0
                  • M mpapeo

                    Sory i thought i posted it #include unistd.h thanx -oam-

                    R Offline
                    R Offline
                    Ryan Binns
                    wrote on last edited by
                    #16

                    I've generally found that you can just delete this line and it will work under Windows. Don't quote me on that though, it may not work at all.

                    Ryan

                    "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

                    1 Reply Last reply
                    0
                    • T ThatsAlok

                      My collegue have ported some Project from Unix enviornment to windows enviornment. Here is What i found in unistd.h

                      /*
                      * This file is part of the Mingw32 package.
                      *
                      * unistd.h maps (roughly) to io.h
                      */

                      #ifndef _UNISTD_H
                      #define _UNISTD_H

                      #include <io.h>
                      #include <process.h>

                      #endif /* _UNISTD_H */


                      [Vote One Here, Complete my Survey....] Alok Gupta
                      visit me at http://www.thisisalok.tk          "I Think Believe this Will Help"

                      M Offline
                      M Offline
                      mpapeo
                      wrote on last edited by
                      #17

                      Well i was interested in the code i sent before as it was running in unix but it is possible run it on windows platform. I wanted to use that code somewhere in one of my programs Any help pliz -oam-

                      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