CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2010
    Posts
    1

    Unhappy [n00b question] How to compile without havin header files

    Hi,

    I'm very new at C++ but I'm learning it.. I also could write my first simple programs with variables etc. My only question is how to compile sources without the .h files? I mean when I download game sources and other sources from Source Sites on the WWW there is mostly only the .ccp file with the main source code but no header files.. how to compile something like that??

    Thanks
    annonym/n00b

  2. #2
    Join Date
    Apr 2008
    Posts
    725

    Re: [n00b question] How to compile without havin header files

    with difficulty.

  3. #3
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: [n00b question] How to compile without havin header files

    A lot of the needed headers come with the compiler. If additional ones are needed you have to download that package/library as well.
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

  4. #4
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: [n00b question] How to compile without havin header files

    Your question doesn't make a whole lot of sense. You can't compile a program unless you have all the files it needs. Which header files are you referring to? Standard library files, or header files that are part of the source you download?

  5. #5
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: [n00b question] How to compile without havin header files

    In rare cases, you may be able to link in libraries originally built in a different language by forward-declaring the symbols from them that you need to use. For instance, you could do this to link a C program against a FORTRAN implementation of LAPACK. However, you need to be very careful that the calling convention is compatible, and the interpretation of the data on the other end is what you expect. In the above example, for instance, the FORTRAN library would interpret any passed matrices as column-major while C would see them as row-major.

  6. #6
    Join Date
    Oct 2009
    Posts
    577

    Smile Re: [n00b question] How to compile without havin header files

    The project header files you can deduce from cpp files though you may encounter problems if they used inline functions or multiple inheritance or inheritance from non-project classes where you have no sources at all.

    The header files from runtime llibraries or third party you might get from the web.

    I would say for non-trivial programs it isn't worth the efforts cause you necessarily will experience parts in the source which cannot be used without the original header files.

    I think it would be better you would try to ask the author of the sources to send you the missing sources. That probably is only fair.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured