Short introduction to header files in C

  Рет қаралды 89,297

CodeVault

CodeVault

Күн бұрын

Пікірлер: 89
@dawnald4846
@dawnald4846 3 жыл бұрын
The best explanation i have found on the internet. Thank you!
@christianjoseph68
@christianjoseph68 Жыл бұрын
Absolutely. Infact I am subscribing immediately
@thisisibrokhim
@thisisibrokhim 2 жыл бұрын
Spent 13:33 minutes and almost mastered the process of creating and using header files. Thank you!
@alexisthibodeau1300
@alexisthibodeau1300 2 жыл бұрын
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
@metmay
@metmay Жыл бұрын
these are the best c videos on the internet. thank you!
@marshmaker2873
@marshmaker2873 10 ай бұрын
this is the best explanation for header files!
@Mushting
@Mushting 2 жыл бұрын
Great video! Very informative and I like the way you deliver and explain things. Thanks so much
@rky-ke
@rky-ke Жыл бұрын
watched this explicit video, and had to subscribe with immediate effect.
@bh3302
@bh3302 Жыл бұрын
I was always confused about the difference between defining and declaring something. Thank you so much for making that clear.
@alessandropasqui6160
@alessandropasqui6160 Жыл бұрын
Thank you for your clear and concise way of explaining such concepts!!
@samarthtandale9121
@samarthtandale9121 Жыл бұрын
Your videos are truely so much valuable !!!
@santiagofonzo9336
@santiagofonzo9336 Жыл бұрын
Crystal clear explanation! Thank you!
@AsifKhan-bt6kg
@AsifKhan-bt6kg 9 ай бұрын
CODEVAULT YOU'RE THE CODE FOR THIS !!! THANK YOUUU
@KatarinaClaes-q1p
@KatarinaClaes-q1p Ай бұрын
Damn, your videos are golden.
@flaviocampos3581
@flaviocampos3581 3 жыл бұрын
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 жыл бұрын
I'll look into it
@shvideo1
@shvideo1 3 жыл бұрын
Excellent detailed explanation. Thank you for this great video and taking the time to make it.
@lkwid9483
@lkwid9483 3 жыл бұрын
Thank you so much for the explanation I've been looking for it all day
@codex8797
@codex8797 3 жыл бұрын
Thanks man. Helped me a lot with my college project.
@Sakapaka
@Sakapaka Жыл бұрын
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 Жыл бұрын
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
@romagnolirojas10
@romagnolirojas10 2 жыл бұрын
great video because you gave context to the solution of header files. TY
@jessamariemangubat406
@jessamariemangubat406 4 жыл бұрын
Thank you so much Sir! Such a very big help
@CodeVault
@CodeVault 4 жыл бұрын
Glad to be of help! Feel free to join our Discord server at discord.code-vault.net
@awaski977
@awaski977 Жыл бұрын
Amazing explanation! Thanks a lot!
@victoramorim7650
@victoramorim7650 Жыл бұрын
Just amazing! Great work!
@AnandRaj-ck2yw
@AnandRaj-ck2yw 3 ай бұрын
please upload more videos on header files
@CodeVault
@CodeVault 3 ай бұрын
I have one actually planned
@alialtan129
@alialtan129 Жыл бұрын
It doesn't matter what the topic is, if CodeVault is explaining, I am understanding. Simple as
@totsh2056
@totsh2056 2 жыл бұрын
how does the program know where to find the function definition / body?
@CodeVault
@CodeVault 2 жыл бұрын
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 2 жыл бұрын
​@@CodeVault Thank you so much. This clears it up perfectly. Thank you.
@juniorrokudevelopertutoria3734
@juniorrokudevelopertutoria3734 3 ай бұрын
Explanation is pretty good.
@nandorboda8049
@nandorboda8049 6 күн бұрын
You have to inculde the header file in both .c files, right?
@Antyelektronika
@Antyelektronika 3 жыл бұрын
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 жыл бұрын
Here's a list of them: www.cplusplus.com/doc/tutorial/preprocessor/ You can do all sorts of things with preprocessor directives
@joshuablanchard6789
@joshuablanchard6789 Жыл бұрын
your voice calms me
@salad5962
@salad5962 2 жыл бұрын
Very comprehensive; many thanks.
@parrotparrot1948
@parrotparrot1948 2 жыл бұрын
You earned yourself a subscriber :)
@satvikkapoor23859
@satvikkapoor23859 2 жыл бұрын
Had to watch this video twice but it's clear now 👍
@gammyhorse
@gammyhorse Жыл бұрын
Can you make a video about unity builds, how they work?
@CodeVault
@CodeVault Жыл бұрын
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 Жыл бұрын
@@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 Жыл бұрын
I'll look into it
@sageeuthanasia9324
@sageeuthanasia9324 Жыл бұрын
Very helpful and very much appreciated
@李睿恩-f5x
@李睿恩-f5x 3 жыл бұрын
Where is the video with how to share gobal varible between the files in the project?? I can't find it
@CodeVault
@CodeVault 3 жыл бұрын
I don't think there is one yet. I'll look into it!
@xrguktmfpb
@xrguktmfpb 3 жыл бұрын
You could use the `extern` keyword for declaring a global variable IIRC
@randomperson4321
@randomperson4321 2 жыл бұрын
thank you so much ,amazing explaination
@afiqyahya3398
@afiqyahya3398 2 жыл бұрын
Is there any video for your vs code confif?
@CodeVault
@CodeVault 2 жыл бұрын
Yes, there is: code-vault.net/lesson/tv93s6yw9r:1610568955955
@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
@ahmedgames9335
@ahmedgames9335 10 ай бұрын
i get this error -> #error directive: "No Target Architecture" when i create a other c file in SourceFile Folder except main.c
@CodeVault
@CodeVault 8 ай бұрын
I think you need to select the architecture that you are building for (x64 probably) in the project settings
@mykolazhabko3228
@mykolazhabko3228 3 жыл бұрын
Thanks man! Helpful!!
@mohmmedfathy8093
@mohmmedfathy8093 2 жыл бұрын
thank you very much for this explination
@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 2 жыл бұрын
This video talks about exactly your issue: code-vault.net/lesson/il55l1ce8h:1642625255796
@amenkalai8442
@amenkalai8442 Жыл бұрын
What is the ide you're using? is it visual studio?
@CodeVault
@CodeVault 11 ай бұрын
Yes, it's Visual Studio Community edition
@aditim1064
@aditim1064 3 жыл бұрын
Hey thanks for the video. It solved a query I had.
@sarthakssoni
@sarthakssoni 9 ай бұрын
Best explanation
@sajolsajol8393
@sajolsajol8393 2 жыл бұрын
Dude Thank You Very Much...... Really Good......
@joeyb8006
@joeyb8006 3 жыл бұрын
that was good thank you
@africanochan
@africanochan 3 жыл бұрын
Thank you for explanation
@powergladius
@powergladius 2 жыл бұрын
Legend
@eomith759
@eomith759 3 жыл бұрын
Well explained! Thank you :)
@Ahmed_Elhaddad
@Ahmed_Elhaddad 2 жыл бұрын
earned a sub
@ssahillppatell
@ssahillppatell 8 ай бұрын
Thanks man
@babyzonechanell
@babyzonechanell 2 жыл бұрын
thank you 👍
@tangerin511
@tangerin511 8 ай бұрын
thank you
@hifa6205
@hifa6205 3 жыл бұрын
thank you 🧡
@ronjeremy1232
@ronjeremy1232 4 жыл бұрын
nice
@diegonayalazo
@diegonayalazo 3 жыл бұрын
Thanks!
@RameenFallschirmjager
@RameenFallschirmjager 4 жыл бұрын
the picture of yours occupying a big chunk of frame doesn't help at all!👎
@CodeVault
@CodeVault 4 жыл бұрын
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 4 жыл бұрын
@@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 4 жыл бұрын
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 4 жыл бұрын
@@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 4 жыл бұрын
I actually found the webcam very useful. Good stuff!
@dankhilkevich8559
@dankhilkevich8559 8 ай бұрын
THANKS!
why do header files even exist?
10:53
Low Level
Рет қаралды 441 М.
Makefiles Make Your Life Easier
12:05
NeuralNine
Рет қаралды 114 М.
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 120 МЛН
Multiple Files in C (Header and Source Files)
26:07
Jonathan Muckell
Рет қаралды 19 М.
Header Issues: Guards, Name Mangling, and extern "C"
8:32
Jacob Sorber
Рет қаралды 79 М.
How to have Multiple Main Files in Code Blocks
6:05
B P
Рет қаралды 49 М.
Header files and libraries (Kevin Lynch)
9:32
Northwestern Robotics
Рет қаралды 97 М.
you will never ask about pointers again after watching this video
8:03
String In Char Array VS. Pointer To String Literal | C Programming Tutorial
9:58
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 120 МЛН