Short introduction to header files in C

แชร์
ฝัง
  • เผยแพร่เมื่อ 13 เม.ย. 2020
  • Check out our Discord server: / discord

ความคิดเห็น • 84

  • @dawnald4846
    @dawnald4846 3 ปีที่แล้ว +65

    The best explanation i have found on the internet. Thank you!

    • @christianjoseph68
      @christianjoseph68 ปีที่แล้ว +1

      Absolutely. Infact I am subscribing immediately

  • @alexisthibodeau1300
    @alexisthibodeau1300 ปีที่แล้ว +9

    I spent 2 hours in class for this simple topic, still had no idea how to do header files and source files, or even understanding the difference between them. I found your video and undrstood it in 13 minutes... I think I found my new teacher here

  • @Mushting
    @Mushting ปีที่แล้ว +10

    Great video! Very informative and I like the way you deliver and explain things. Thanks so much

  • @metmay
    @metmay ปีที่แล้ว +3

    these are the best c videos on the internet. thank you!

  • @thisisibrokhim
    @thisisibrokhim ปีที่แล้ว +3

    Spent 13:33 minutes and almost mastered the process of creating and using header files. Thank you!

  • @shvideo1
    @shvideo1 2 ปีที่แล้ว +3

    Excellent detailed explanation. Thank you for this great video and taking the time to make it.

  • @alessandropasqui6160
    @alessandropasqui6160 ปีที่แล้ว +2

    Thank you for your clear and concise way of explaining such concepts!!

  • @bh3302
    @bh3302 ปีที่แล้ว +2

    I was always confused about the difference between defining and declaring something. Thank you so much for making that clear.

  • @lkwid9483
    @lkwid9483 3 ปีที่แล้ว +3

    Thank you so much for the explanation I've been looking for it all day

  • @marshmaker2873
    @marshmaker2873 4 หลายเดือนก่อน +1

    this is the best explanation for header files!

  • @samarthtandale9121
    @samarthtandale9121 ปีที่แล้ว +1

    Your videos are truely so much valuable !!!

  • @codex8797
    @codex8797 3 ปีที่แล้ว +3

    Thanks man. Helped me a lot with my college project.

  • @santiagofonzo9336
    @santiagofonzo9336 ปีที่แล้ว +1

    Crystal clear explanation! Thank you!

  • @rky-ke
    @rky-ke ปีที่แล้ว +1

    watched this explicit video, and had to subscribe with immediate effect.

  • @awaski977
    @awaski977 ปีที่แล้ว +1

    Amazing explanation! Thanks a lot!

  • @romagnolirojas10
    @romagnolirojas10 ปีที่แล้ว

    great video because you gave context to the solution of header files. TY

  • @victoramorim7650
    @victoramorim7650 8 หลายเดือนก่อน

    Just amazing! Great work!

  • @salad5962
    @salad5962 2 ปีที่แล้ว

    Very comprehensive; many thanks.

  • @AsifKhan-bt6kg
    @AsifKhan-bt6kg 3 หลายเดือนก่อน +1

    CODEVAULT YOU'RE THE CODE FOR THIS !!! THANK YOUUU

  • @flaviocampos3581
    @flaviocampos3581 3 ปีที่แล้ว +18

    Thank you ! I really like the way you explain things.
    Is it possible to make a video about Makefile? Using headers and stuff? (I still didn't get to that topic but will be my next one soon, once I finish the headers).

    • @CodeVault
      @CodeVault  3 ปีที่แล้ว +6

      I'll look into it

  • @jessamariemangubat406
    @jessamariemangubat406 3 ปีที่แล้ว +3

    Thank you so much Sir! Such a very big help

    • @CodeVault
      @CodeVault  3 ปีที่แล้ว +1

      Glad to be of help! Feel free to join our Discord server at discord.code-vault.net

  • @parrotparrot1948
    @parrotparrot1948 2 ปีที่แล้ว

    You earned yourself a subscriber :)

  • @mykolazhabko3228
    @mykolazhabko3228 3 ปีที่แล้ว +1

    Thanks man! Helpful!!

  • @randomperson4321
    @randomperson4321 ปีที่แล้ว

    thank you so much ,amazing explaination

  • @joshuablanchard6789
    @joshuablanchard6789 ปีที่แล้ว

    your voice calms me

  • @sageeuthanasia9324
    @sageeuthanasia9324 ปีที่แล้ว

    Very helpful and very much appreciated

  • @africanochan
    @africanochan 2 ปีที่แล้ว

    Thank you for explanation

  • @aditim1064
    @aditim1064 2 ปีที่แล้ว

    Hey thanks for the video. It solved a query I had.

  • @mohmmedfathy8093
    @mohmmedfathy8093 2 ปีที่แล้ว

    thank you very much for this explination

  • @joeyb8006
    @joeyb8006 3 ปีที่แล้ว +1

    that was good thank you

  • @powergladius
    @powergladius ปีที่แล้ว

    Legend

  • @sarthakssoni
    @sarthakssoni 3 หลายเดือนก่อน

    Best explanation

  • @sajolsajol8393
    @sajolsajol8393 ปีที่แล้ว

    Dude Thank You Very Much......
    Really Good......

  • @ssahillppatell
    @ssahillppatell 3 หลายเดือนก่อน

    Thanks man

  • @hifa6205
    @hifa6205 2 ปีที่แล้ว

    thank you 🧡

  • @Ahmed_Elhaddad
    @Ahmed_Elhaddad ปีที่แล้ว

    earned a sub

  • @eomith759
    @eomith759 3 ปีที่แล้ว +1

    Well explained! Thank you :)

  • @diegonayalazo
    @diegonayalazo 2 ปีที่แล้ว

    Thanks!

  • @dankhilkevich8559
    @dankhilkevich8559 3 หลายเดือนก่อน

    THANKS!

  • @tangerin511
    @tangerin511 3 หลายเดือนก่อน

    thank you

  • @babyzonechanell
    @babyzonechanell ปีที่แล้ว

    thank you 👍

  • @satvikkapoor23859
    @satvikkapoor23859 ปีที่แล้ว

    Had to watch this video twice but it's clear now 👍

  • @ronjeremy1232
    @ronjeremy1232 4 ปีที่แล้ว +1

    nice

  • @alialtan129
    @alialtan129 ปีที่แล้ว

    It doesn't matter what the topic is, if CodeVault is explaining, I am understanding. Simple as

  • @Sakapaka
    @Sakapaka 9 หลายเดือนก่อน

    just want to confirm that i understand, basically when you run the code it compiles all of the .c files together, and the .h which you included lets say in main.c just tells the program that somewhere in the program (most likely in a different .c) exist the definition of the function which was declared in the .h

    • @CodeVault
      @CodeVault  8 หลายเดือนก่อน

      Something like that. First is the preprocessor that includes the .h files that we specified at the top. Then, each .c file gets compiled individually into a object file for any syntax errors (here some symbols might not be defined yet). Then, the linker comes along and links all the object files together and checks if all the symbols (varibles and functions etc.) are defined properly

  • @Antyelektronika
    @Antyelektronika 3 ปีที่แล้ว +1

    I understand that pragram is a preprocessor keyword, what else beside include and define we have?, and where I can find them, thank you for this informativ video

    • @CodeVault
      @CodeVault  3 ปีที่แล้ว +2

      Here's a list of them: www.cplusplus.com/doc/tutorial/preprocessor/
      You can do all sorts of things with preprocessor directives

  • @amenkalai8442
    @amenkalai8442 6 หลายเดือนก่อน

    What is the ide you're using? is it visual studio?

    • @CodeVault
      @CodeVault  5 หลายเดือนก่อน

      Yes, it's Visual Studio Community edition

  • @gammyhorse
    @gammyhorse 8 หลายเดือนก่อน

    Can you make a video about unity builds, how they work?

    • @CodeVault
      @CodeVault  8 หลายเดือนก่อน +1

      I don't think I will make a video on the subject. But maybe I will create a series about making a simple video game engine from scratch (although there are plenty other good videos about this already)

    • @gammyhorse
      @gammyhorse 8 หลายเดือนก่อน

      @@CodeVault That's awesome. Please do, even though there are plenty other videos, because your explanations are very clear. I would really like to see your thought process. Of course if you have the time. Anyway thank you very much for responding my question. Take care.

  • @yassinemakhlouf9907
    @yassinemakhlouf9907 ปีที่แล้ว

    is it possible to include a header file with full path
    if yes can you show me how both in windows and linux
    thank you so much

    • @CodeVault
      @CodeVault  ปีที่แล้ว +1

      I'll look into it

  • @totsh2056
    @totsh2056 ปีที่แล้ว +1

    how does the program know where to find the function definition / body?

    • @CodeVault
      @CodeVault  ปีที่แล้ว +1

      It happens during compilation. Whenever you say:
      gcc main.c -o main
      It looks into main.c (and standard libraries) for the function body. If you have another .c file with function definitions then you would need to add it in that gcc command, like so:
      gcc main.c utils.c -o main
      The process is a bit more complex. GCC has two steps that it takes to achieve an executable, one is compilation (which happens for each .c files individually) that's where those declarations and header files are important and the second one is the linker process which basically links actual function declarations with definitions and everything else into one single executable. You can search for these terms to learn more: compiler vs linker, static linking, dynamic linking... I may make more videos on the topic

    • @totsh2056
      @totsh2056 ปีที่แล้ว

      ​@@CodeVault Thank you so much. This clears it up perfectly. Thank you.

  • @arkemal
    @arkemal 2 ปีที่แล้ว

    Thanks for this explanation.
    I'm using VSCode.
    If I include the header file in my main.c file, I've got the error:
    Undefined symbols for architecture x86_64:
    "_stringsExample", referenced from:
    _main in main-17dc44.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    however, if include the .c file, it works fine. Any idea why?
    When using Xcode, I can include the .h file, but with vs code, I need the .c file

    • @arkemal
      @arkemal 2 ปีที่แล้ว

      ps: stringsExample() is a function I'm calling from my main() function

    • @CodeVault
      @CodeVault  ปีที่แล้ว

      This video talks about exactly your issue: code-vault.net/lesson/il55l1ce8h:1642625255796

  • @afiqyahya3398
    @afiqyahya3398 ปีที่แล้ว

    Is there any video for your vs code confif?

    • @CodeVault
      @CodeVault  ปีที่แล้ว

      Yes, there is: code-vault.net/lesson/tv93s6yw9r:1610568955955

  • @ahmedgames9335
    @ahmedgames9335 4 หลายเดือนก่อน

    i get this error -> #error directive: "No Target Architecture"
    when i create a other c file in SourceFile Folder except main.c

    • @CodeVault
      @CodeVault  2 หลายเดือนก่อน

      I think you need to select the architecture that you are building for (x64 probably) in the project settings

  • @incodewetrust8862
    @incodewetrust8862 ปีที่แล้ว

    projet_folder
    |
    headerr_folder
    | file1.h,file2.h,file3.h
    src_folder
    | file1.c,file2.c,main.c
    Makefile
    if stdlib pr stdio or math.h in not include in file1.h or file2.h can't you se their function
    if file1.h and 2.h are not included in main undeclared variable first used in this function main line xx, if file1.h are included conflicting type previous declaration of variable ...
    it's painfull and hopeless !

    • @CodeVault
      @CodeVault  ปีที่แล้ว

      C splits the definition and declaration of variables and functions into header and implementation files. These videos should help a bit understand why you're getting errors when including files that contain the definition of the same variable:
      code-vault.net/lesson/6d7531sjbg:1642359047453
      code-vault.net/lesson/fjri9hcdte:1642359047479

  • @user-je3jj6fu7y
    @user-je3jj6fu7y 2 ปีที่แล้ว

    Where is the video with how to share gobal varible between the files in the project?? I can't find it

    • @CodeVault
      @CodeVault  2 ปีที่แล้ว

      I don't think there is one yet. I'll look into it!

    • @richieseputro0
      @richieseputro0 2 ปีที่แล้ว

      You could use the `extern` keyword for declaring a global variable IIRC

  • @RameenFallschirmjager
    @RameenFallschirmjager 3 ปีที่แล้ว +1

    the picture of yours occupying a big chunk of frame doesn't help at all!👎

    • @CodeVault
      @CodeVault  3 ปีที่แล้ว +1

      Hey! I'm sorry about that. I'm trying to not cover important parts with the webcam as much as possible. Where were you not able to see? I could help clarify things

    • @RameenFallschirmjager
      @RameenFallschirmjager 3 ปีที่แล้ว

      @@CodeVault You are distracting! I didn't watch the video because of that. No hard feelings. I think when someone shows up during tutorials video is distracting and it's just bad taste. Look at other channels. The best youtubers who make tutorials like you never show themselves during video.

    • @CodeVault
      @CodeVault  3 ปีที่แล้ว +5

      Alright, thanks for the feedback. I'll keep that in mind although, I don't think I'll change this style of videos as nobody else found an issue with this yet.

    • @SamSarwat90
      @SamSarwat90 3 ปีที่แล้ว +9

      @@CodeVault Don't listen to this fool (rameen). Clearly just being toxic. I dont find it distracting at all. Keep up the great work! Very appreciated.

    • @magnuslundstrm3719
      @magnuslundstrm3719 3 ปีที่แล้ว +4

      I actually found the webcam very useful. Good stuff!