Understanding Header Files in C

Поделиться
HTML-код
  • Опубликовано: 11 сен 2024
  • We all use header files in C, but what are they? They are files that hold the declaration of functions and constants that we can use in our main code. The declared functions still need to be defined compiled. In C the headers file has just the declaration and it is the source file that has the definition. If it is not in source then the definition must be in a library file that is already compiled and accessible on your system. For example the stdio.h will link to the glib.c module. Using both an IDE and the command line we explain how the linking works
    Additionally you can find my video courses on Pluralsight: pluralsight.com... and take time to see my own site www.theurbanpen...
    ~-~~-~~~-~~-~
    Please watch: "RHCSA 9 Working With Podman Containers"
    • How To Use Podman Cont...
    ~-~~-~~~-~~-~

Комментарии • 15

  • @georgichalakov6727
    @georgichalakov6727 2 года назад +4

    Thank you very much! This is the best explanation i watched on the subject.

  • @Apathetic-co3cw
    @Apathetic-co3cw Месяц назад +1

    Thanks Old man!

  • @mxhunts
    @mxhunts Год назад +2

    Thanks for this. Rest on Lori.

  • @QuimChaos
    @QuimChaos 2 года назад +3

    thanks! that was a good scrub! i'm learning C/C++ but this kind of thing is usually push aside...

  • @justchary
    @justchary 2 года назад +1

    Good description, thank you

  • @gpu_governor
    @gpu_governor 9 месяцев назад

    Your IDE fonts are too small, I can't see what you are doing on my Android phone 7inch screen

  • @adriansrealm
    @adriansrealm 2 года назад +1

    Is this leading up to a video about the linker?

    • @theurbanpenguin
      @theurbanpenguin  2 года назад +1

      Let me know what you are looking for. Here is the linker option in gcc to use dynamic modules, .so files www.theurbanpenguin.com/understanding-shared-libraries-in-linux/

  • @anissarafa6758
    @anissarafa6758 Год назад +1

    a ton of useless explanation, you didnt show us how to creat a header file

    • @theurbanpenguin
      @theurbanpenguin  Год назад +6

      Sorry. Didn’t know you needed a lesson in using a text editor

    • @BlessedDog
      @BlessedDog Год назад +2

      just create a new file called whatever.h and edit it

  • @Samuftie
    @Samuftie Год назад +1

    Hi! great explanation, but up until 8:00 and tried to compile my main.c , I got an error of 'lang: error: linker command failed with exit code 1 (use -v to see invocation)' . why is this happening? Seems like there is no connection betweeh myheader.h and hello.c

    • @lylecozartminer3091
      @lylecozartminer3091 5 месяцев назад

      @_Oliver__ I have the same too, what's the update?

    • @UnTamedStArBlOb
      @UnTamedStArBlOb 4 месяца назад

      Are you storing the header file in a different directory from the main source file if so you're going to need to use ./include or whatever your header is at. this will allow your search path to go back up a directory".." this will allow boing back multiple directories "../.." there could also be an issue with the projects included headers locations if you want help personally with it let us know