How to Include File Guards - Why to Include Fileguards in C or C++ Header Files

Поделиться
HTML-код
  • Опубликовано: 23 ноя 2024

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

  • @juanma_cello
    @juanma_cello 3 года назад +56

    This is the best explanation someone could give me for this issue.
    Dude you're brilliant.

  • @javxa
    @javxa 5 лет назад +45

    Awesome explanation, step-by-step. Keep it up!

  • @TheArien
    @TheArien 3 месяца назад

    9 years later and your video is still super relevant. You saved me from hours of useless work of trying to reconfigure my entire project structure.

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

    So simple and straight to the point, truly a master at work!

  • @Tweek5470
    @Tweek5470 4 года назад +6

    I really loved that you went through the code step by step to show what the compiler was doing. That really helped, thanks!

  • @JamateyLP
    @JamateyLP 6 лет назад +13

    I searched a lot, and finally I found such a brilliant video. Thank you so much !!! This is one of the best explainations I have ever seen, slow (so that everyone can follow) and also showing everything so that everyone understands. THANKS!

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

    Ah, thank you! I looked up numerous videos on this because the C++ Udemy course I am taking introduced File Guards and I couldn't understand why the alias in the file guards could be so arbitrary, but the way you explained it helped clear that up perfectly. Thank you for that!

  • @lawrenegummy4736
    @lawrenegummy4736 4 года назад +4

    I love how you go through each line and explain what does what instead of what you should just do.
    It helps a lot when we understand why something is done instead of when you should just do it.
    You have a fan in me. Liked and Subbed, please do more videos.

  • @shamarahshoup5253
    @shamarahshoup5253 Год назад

    Instant subscribe. Explained this faster in 5 minutes than my professor in 3 weeks

  • @kacperracing5798
    @kacperracing5798 3 года назад +3

    Hey Paul, I found your video much better than the one I got linked in my class. Very clear, very simple and very fast. Thanks for your help! thumbs up!

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

    Hi Paul you have the best display screen than the other teachers well done

  • @vutuan4308
    @vutuan4308 Год назад

    Thank you for explaning so clearly. I've had difficulties with this since i studied OOP with C++.

  • @lorenzolonghi8697
    @lorenzolonghi8697 Год назад

    Most simple and clear definition, good job and thank you

  • @kouko6727
    @kouko6727 3 года назад

    THANK YOU my cs professor didn't teach us about fireguards when we entered classes and inheritance and this redefinition was killing me for hours.

  • @chrisr3947
    @chrisr3947 5 лет назад +1

    Thank you for this explanation of file guards. I am fairly new to c++ and this was straightforward and easy to understand!

  • @Souffra
    @Souffra 3 месяца назад

    Thank you, I finally got the explanation that I can understand. Bravo!!!

  • @CarlosRedman3
    @CarlosRedman3 Год назад

    Bro that was clearest explanation I have ever heard. Great Job buddy . Thank you
    !

  • @abdulsammadsaeed1199
    @abdulsammadsaeed1199 3 года назад

    THANKS MAAN!!! I WAS STUCK ON THIS FOR A WHILE. YOUR EXPLANATION IS TOP NOTCH!

  • @Perceptionz_Sound
    @Perceptionz_Sound 2 года назад

    Thanks for your content and Great video. Ive been learning c++ out of a text book for the past couple weeks and these videos are a great way to visualize and make those new connections of things i cant picture or wrap my head around while reading and writing notes.

  • @I_make_countless_mistakes
    @I_make_countless_mistakes 2 года назад

    Gosh!!! yours explanation is so clearr.

  • @elyrb1185
    @elyrb1185 5 лет назад +8

    This is so informative, explanations were very clear and it helped me a lot in my project, thanks, you got yourself a subscriber :D

  • @Travelling_turtle07
    @Travelling_turtle07 Час назад

    Thanksss, simple and straightforward

  • @ZapPack
    @ZapPack 10 месяцев назад

    This is greatly helpful and I like that you explained what ALL of the terms mean and what exactly is happening (ex. why "ifndef" is named the way it is) 👍

    • @areshaistg
      @areshaistg 10 месяцев назад

      it's probably if not defined. there's also "ifdef", "if", "else", and "endif". i'm not sure about others but it's called preprocessor directives :)

  • @paraspatil1375
    @paraspatil1375 2 года назад

    Best explanation you would find on youtube..bro just don't give up on sharing such awesome content. Thankyou for precious knowledge you have shared with us

  • @김뉴비-f4z
    @김뉴비-f4z Год назад

    you are so genius you make me understanding Conditonal Compilation

  • @sirjohn6299
    @sirjohn6299 3 года назад

    Very clear and concise explanation, you have earned a subscriber!

  • @dansalvador5071
    @dansalvador5071 2 года назад

    I wasn`t planning to write a comment but bro thats awesome. thanks for the explanation.

  • @KachraSethisLive
    @KachraSethisLive 3 года назад

    Thanks a lot this help me a lot i am trying to fix this issue from 36 hours but now it's fixed thankyou so much

  • @vaibhavpaliwal7754
    @vaibhavpaliwal7754 2 года назад

    BEST EXPLANATION EVER!!!!!

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

    Thank you so much! You just saved my project, you're my hero :p

  • @joevz8758
    @joevz8758 5 лет назад

    Thanks for explaining every tid bit, this is rarely done in tutorials, Thanks!

  • @filippocucina7001
    @filippocucina7001 2 года назад

    The Best Explanation ever!

  • @hiteshsinha7210
    @hiteshsinha7210 2 года назад

    thank this is the best explanation I have found.

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

    Brilliant. I just had a problem understanding the "#endif" directive. thank you

  • @JonCianci12
    @JonCianci12 2 года назад

    Perfect this is just what I was looking for!!

  • @SuperLuxen
    @SuperLuxen Год назад

    Exactly what I needed to know, thank's man!

  • @henrikstaaf3293
    @henrikstaaf3293 3 месяца назад

    My god you are a good teacher my friend!

    • @henryharrison608
      @henryharrison608 2 месяца назад

      Why are them fileguards in uppercase , what if the class was declared in uppercase

  • @NeelSandellISAWESOME
    @NeelSandellISAWESOME 5 лет назад +1

    Thank you so much. This really cleared things up for me.

  • @zkkvfvfv5117
    @zkkvfvfv5117 4 года назад

    simple and straight to the point. thank you

  • @sivaramakrishnachitithoti839
    @sivaramakrishnachitithoti839 6 лет назад

    Very good explanation... well explained with good example scenario..

  • @zinhlekeswa5748
    @zinhlekeswa5748 Год назад

    Great explanation. Thank you Paul!!!😁

  • @hfe1833
    @hfe1833 4 года назад

    This is very useful for finding error in arduino library or debugging

  • @peter_castle
    @peter_castle 5 лет назад

    This videos helped a lot! Subscribed and will binge watch

  • @kv6257
    @kv6257 6 лет назад

    Thanks a lot , you explane me very good how to use header files and with g++ tool.
    Thanks !

  • @intros1854
    @intros1854 8 лет назад

    This tutorial is pretty clear! Thanks.

  • @cesarcalderon2499
    @cesarcalderon2499 3 года назад

    Thanks man i was having a hard time understanding it perfect thank you

  • @mrx-qi8th
    @mrx-qi8th 3 года назад

    Thank u thank u thank u
    Just cant thank you enought
    I learned something valuable and
    Managed to solve my problem
    Just subscribed

  • @ankitapatil5524
    @ankitapatil5524 4 года назад

    this was a good explanation paul.

  • @justapasserby773
    @justapasserby773 2 года назад

    youre a life saver man

  • @stargazer2350
    @stargazer2350 4 года назад

    This is really great. Thank you Paul.

  • @jacobes5084
    @jacobes5084 Год назад

    Actually such a super helpful video thank you so much, what a 🐐

  • @TheDrewfuss
    @TheDrewfuss 9 лет назад

    Thanks for that. Very clear and quick.

  • @resolvedman
    @resolvedman Год назад

    U SAVE MY LIFE BRO!!!!!!!

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

    Crisp and Informative. Thanks

  • @jokar_2541
    @jokar_2541 2 года назад

    ah man thanks a lot it's been days since i am tried to find a solution to this problem

  • @ayoubdkhissi
    @ayoubdkhissi 3 года назад

    Very clear explanation! thanks

  • @thekiwininja99
    @thekiwininja99 Год назад

    This was so helpful, thank you!!

  • @gaskomusic
    @gaskomusic 4 года назад

    Such a great explanation. Thanks!

  • @voidenth
    @voidenth 8 месяцев назад

    brilliantly explained

  • @mkhadka123
    @mkhadka123 3 года назад

    Nice and Easy, awesome video!

  • @muhammadabumadeghem9675
    @muhammadabumadeghem9675 5 лет назад

    you just give us a wonderfull answer . Thx

  • @moinaction
    @moinaction 6 лет назад

    Best explanation ever!

  • @mickballard7400
    @mickballard7400 6 лет назад

    Well explained Paul.

  • @QuangHungNguyen-n2w
    @QuangHungNguyen-n2w Год назад

    Best explanation. Thanks

  • @jaakob1128
    @jaakob1128 4 года назад

    Good tutorial! Keep up the good work!

  • @LukasanaTK
    @LukasanaTK 8 лет назад

    explained it very well, subbed.

  • @TViener
    @TViener 8 лет назад

    Just subbed. Thanks for clearing this up for me!

  • @MsGrooveOn
    @MsGrooveOn 7 лет назад +41

    You should note about another approach (#pragma once)

    • @PaulProgramming
      @PaulProgramming  7 лет назад +8

      Kirugan p Yes, that's a great idea. Thanks for the suggestion!

    • @lawrenegummy4736
      @lawrenegummy4736 4 года назад +12

      (#pragma once) is not an original component of C++, as such it may work properly on some compilers but it may not work with some. Traditional Header guards will however safely compile in most if not all C++ compilers.

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

      the right approach is: do not nest includes

    • @sylvesteruchia5263
      @sylvesteruchia5263 Месяц назад

      We don't use pragma once in this house . Standard c++ instructions only .

  • @homamis639
    @homamis639 6 лет назад

    Excellent Explanation!

  • @moardub
    @moardub 4 года назад

    Thank you for this video I appreciate this a lot.

  • @amurkhandzagkoev1842
    @amurkhandzagkoev1842 2 года назад

    I love it! Cool explanation!

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

    Excellent exaplaination

  • @flp905
    @flp905 Год назад

    excellent explanation

  • @charity4613
    @charity4613 4 года назад

    this video is amazing. thank you so much

  • @xdigitalmondx2
    @xdigitalmondx2 7 лет назад

    Great explanation! thank you.

  • @padmakumarnxt
    @padmakumarnxt 5 лет назад

    Outstanding tutorial!!.. Subscribed... :)

  • @Cutrexxx
    @Cutrexxx 5 лет назад

    very good explaination. Can you pls tell me, for what are header files exactly?

  • @ihateandreykrasnokutsky
    @ihateandreykrasnokutsky Год назад

    In Visual Studio, when you create a header file, there's an automatically created 1st line "#pragma once". As I understand, it serves the same purpose, but requires just 1 line of code.

  • @emanuelnolasco3745
    @emanuelnolasco3745 Год назад

    I am dummie at C++ language and this was one of the best explanation I have seen. I just have one doubt, What is the meaning of "a.out" in the time 5:15? I don´t get it

  • @metaverseclub5265
    @metaverseclub5265 25 дней назад

    brilliant video. Thank you

  • @avartation
    @avartation 6 лет назад +1

    thanks a lot man !!! helped me a lot

  • @muezapervaiz7163
    @muezapervaiz7163 2 года назад

    very well explained!

  • @gauravpuri8716
    @gauravpuri8716 2 года назад

    Nice Explaination!!!

  • @alexmcd378
    @alexmcd378 6 месяцев назад

    RUclips has made it clear that my college professors were absolute garbage at teaching. You explained in a few minutes what I never learned in a 4 year degree. I just used the guards because I was supposed to. Also engine has now lost all meaning and doesn't sound like a real word anymore 😂

  • @bevedel
    @bevedel 7 лет назад

    thanks for the great explanation

  • @moazelsawaf2000
    @moazelsawaf2000 5 лет назад

    Thanks a lot sir

  • @MrHighpour
    @MrHighpour 6 лет назад

    Thank you so much! This helped!

  • @ednilsonalveslomazi8501
    @ednilsonalveslomazi8501 4 года назад

    man, thank you so much! But i have one question: In inclusion of standard libraries (...) how can i wrapper those includes to avoid redeclaration? Im creating a library, so, i dont know what the user will include in his application.

  • @Drogny
    @Drogny 2 года назад

    Great video, thanks!!

  • @Fun-io9kv
    @Fun-io9kv 3 года назад

    Good explanation thanks

  • @kashishshukla23
    @kashishshukla23 Год назад

    Moral of the story:- fileguards are used to prevent the redefination of the classes or basically of your code

  • @rahulr9301
    @rahulr9301 4 года назад

    after seeing your video i login google account press like and subscribe the channel. Your videos are really helpful paul thankuu .

  • @justcurious1940
    @justcurious1940 10 месяцев назад

    Thanks Paul.

  • @joeydicastro
    @joeydicastro 6 лет назад

    Awesome Paul.

  • @MAsif-sz9md
    @MAsif-sz9md Год назад

    Thank you soo much ❤❤keep it up

  • @dcts7526
    @dcts7526 Год назад

    is there a usecase where you would have multiple Fileguards and name them differently in the same file?

  • @gabriellegal4496
    @gabriellegal4496 2 года назад

    nice explanation

  • @Avdheshkumar-kv5fz
    @Avdheshkumar-kv5fz 2 года назад

    just a bigggg..THANK YOU
    😇

  • @SKREFI
    @SKREFI 6 лет назад

    Ok, nice, but this is only to make sure if you are doing that mistake it won't hurt the project but you can avoid it if you are 100% sure you are not doing this? Right? I mean, you can include the car only and it is ok right? you can use the engine.h content because car.h has it included, is it how this works?

  • @J-WafflezZ
    @J-WafflezZ 7 лет назад

    you are awesome! thank you so much!