Precompiled Headers in C++

  Рет қаралды 158,691

The Cherno

The Cherno

Күн бұрын

Пікірлер: 278
@johanolssonn
@johanolssonn 5 жыл бұрын
Aaaand done. I've watched every single episode of this series, almost 15 hours in total. C++ has never been clearer to me, you're so good at explaining! I have an exam in C++ in about a month and I'm sure I'll do just fine. Thank you, Cherno!
@pilotandy_com
@pilotandy_com 5 жыл бұрын
How did it go?
@chappy1835
@chappy1835 5 жыл бұрын
@@pilotandy_com He failed.
@louisdaza1923
@louisdaza1923 4 жыл бұрын
Chappy made my day dude lmao
@jerfersonmatos28
@jerfersonmatos28 4 жыл бұрын
Me too, I've learned a lot
@vishalbhat8602
@vishalbhat8602 3 жыл бұрын
@@chappy1835 LOL
@domidivo
@domidivo 4 жыл бұрын
I wish I could precompile all your c++ tutorials and load them directly to my memory lol.
@hst2409
@hst2409 3 жыл бұрын
*to my disk would be better :)
@TheArrowedKnee
@TheArrowedKnee 3 жыл бұрын
Nice
@walkmoon3479
@walkmoon3479 2 жыл бұрын
no hard loading, just create a pointer is easy
@projektingenieur8491
@projektingenieur8491 4 ай бұрын
@domidivo Jdownloader can do this for you
@cicciobombo7496
@cicciobombo7496 6 жыл бұрын
Oh yes more c++ juice
@alexandergonzalez5975
@alexandergonzalez5975 6 жыл бұрын
Ciccio&Bombo Lol
@elvinzhang9120
@elvinzhang9120 6 жыл бұрын
yammy
@diverseprogrammer18
@diverseprogrammer18 5 жыл бұрын
That sounds weird but yeah.
@Destroyer19941995
@Destroyer19941995 5 жыл бұрын
mmmmmm Nice bath in c++ enslaved moisture
@mbrown1253
@mbrown1253 3 жыл бұрын
For those using g++, be sure to use the exact same g++ compile options for your precompiled headers as when you compile your project. Also if you're unsure whether your header or the PCH is being used when you compile your project, try adding the -H option when compiling your project. The -H compiler flag will print out which files are compiled, including each header. If the PCH is set up properly you should see a line like "! pch.h.gch" The exclamation point (!) indicates it was successful. If instead you see an X, that indicates there was a problem with the PCH. If you don't see this line and instead are presented with a wall of text printing out each header that was included in the compile, then your header was used instead of the PCH.
@dawiy98
@dawiy98 6 жыл бұрын
thecherno > my college teacher :)
@pooria_garrett3020
@pooria_garrett3020 6 жыл бұрын
So you're free to worship him from now on :)
@neo-babylon7872
@neo-babylon7872 5 жыл бұрын
thecherno = mycollege
@theairaccumulator7144
@theairaccumulator7144 4 жыл бұрын
@@neo-babylon7872 nonono, the_cherno = my_collage;
@julk2701
@julk2701 4 жыл бұрын
@@theairaccumulator7144 How do you misspell college when you literally just read it
@hervesv9529
@hervesv9529 4 жыл бұрын
@@theairaccumulator7144 Wrong again, theCherno = myCollege; camelCasing FTW
@wikiejko
@wikiejko 6 жыл бұрын
I've been following Your channel for like a year now, and I have to say, every video that you make is extremely high quality, both visually and content wise.
@olliveraira6122
@olliveraira6122 3 жыл бұрын
18:42 precompiled headers with GCC (no fancy stuff lol, just a regular compilation)
@Buiscit1738
@Buiscit1738 6 жыл бұрын
g++ precompiled headers? Awesome videos. Joining the Patreon crew. Your videos are better than most c++ books I've read!
@passionfruit7617
@passionfruit7617 2 жыл бұрын
what's g++?
@jukit3906
@jukit3906 2 жыл бұрын
@@passionfruit7617 one of the main C++ compiler for non-Windows platform (with clang, although clang is more macOS while gcc and g++ more linux afaik)
@jukit3906
@jukit3906 2 жыл бұрын
@@passionfruit7617 It's stands for GNU C++ Compiler (GNU stands for GNU is Not Unix, and is an operating system that was **kinda** discontinued but its compiler collection (GCC) has become widespread)
@michaelswahla4927
@michaelswahla4927 2 жыл бұрын
g++ -> c++ compiler gcc -> c compiler
@rishabh5428
@rishabh5428 11 ай бұрын
well g++ should be the same as gcc
@LowLevelLemmy
@LowLevelLemmy Жыл бұрын
cherno, more like cheryes
@Max-wk7cg
@Max-wk7cg 6 жыл бұрын
I've been using them for a while and my first impression was that they are awesome, I just wasn't aware of their potential problems and I'm glad you mentioned them here. I'd like to add that if you are having trouble figuring out header file dependencies when using a precompiled header you should use the /showIncludes compile switch if you're using the msvc compiler. It will print out every header file dependency as they include each other. It's very very useful!
@drwisdom1
@drwisdom1 5 жыл бұрын
Ding! Ding! Ding! This is Mr. TheCherno's best video. Back in the 1980s/early 90s when computers were really slow, my Symantec C++ compiler had precompiled headers which really improved compilation speeds. Now computers are super fast so compiles don't take long, except in one instance - when compiling source that uses windows.h and is stored on a network drive rather than a local drive where it gets cached. I could have been using precompiled headers for the last 30 years and will now investigate if it will provide significant time savings. Of course I have some criticisms but they are small compared to the positives of this video. It took Mr. TheCherno 12 full minutes to say "you don't want to sit around waiting for constant code to compile, use precompiled headers to reduce wait times." I don't care about flipping screens and filling in blanks in Visual Studio, show me the command line so I don't have to research it.
@muhammadtalhabaig4908
@muhammadtalhabaig4908 5 жыл бұрын
And thats it! I have completed this C++ series! And I have to say compared to what I learned in almost an year at my university, I learned more in a week following this series 😃. Thank you cherno for this amazing series and i am looking forward to watch game engine series and others as well! You are my fav teacher from now on 😁. keep up the great work, you are the best!
@Rose_Harmonic
@Rose_Harmonic 3 жыл бұрын
I took a semester of c++ six years ago. I was surprised how quickly he eclipsed everything I learned.
@cargle7514
@cargle7514 6 жыл бұрын
Started using Windows Console Application template in VS and was wondering why the pch.h file was auto-created. Thanks for the information! This helped a lot.
@jeroenkoffeman9402
@jeroenkoffeman9402 4 жыл бұрын
here's an easy way in vs to force include your pch.h file in every source file: Configuration Properties -> C/C++ -> Advanced Type "cph.h" in the "Force Include File" field; this will make the visual studio compiler insert the header file at the beginning of each file without having to include it manually.
@TheDezmen3
@TheDezmen3 3 жыл бұрын
Tried, doesnt really work when u edit cpp file, it wont find stuff without including header manually
@jeroenkoffeman9402
@jeroenkoffeman9402 3 жыл бұрын
@@TheDezmen3 hmm for me it works, did you set it for "all configurations" ? Just checking
@zeevsolomonik6162
@zeevsolomonik6162 3 жыл бұрын
Modules are one of prominent features of standard C++20. They overcome the restrictions of header files and of the preprocessor usage. I would recommend to pay closer attention to this feature since it will eventually boost C++ packages management.
6 жыл бұрын
Correct me if I am wrong but the compiler does not compile the whole std::vector just because you included it. The only template code thats going to be compiled are those that you use (instantiate). So for example if I instantiate a vector and use the push_back method, the only code thats going to be generated are these 2 functions.
@edtExodus
@edtExodus 6 жыл бұрын
The issue isn't necessarily the code generation, but figuring out what code needs to be generated. The pre-processor still needs to parse the entire code unit to figure out what actually needs to be compiled.
@sl66ggehrubt
@sl66ggehrubt 6 жыл бұрын
Wouldn't it be nice if every function was just available, and only included in the compile if called... How can I #include everything? I've got a fast computer.
@shadowmil
@shadowmil 6 жыл бұрын
This is correct. Many compilers don't even parse the template (aside from finding the end) until it does get instantiate. Which can cause the awkward situation that certain syntax errors won't showup unless you instantiate.
@annabelletrinh936
@annabelletrinh936 3 жыл бұрын
For XCode user: → Your pch file should be in the format -Prefix.pch - Go to Build Setting → Turn on → Add the path to your pch file in You don't need to include it in your *.cpp file, it's automatically included.
@serenitynow1978
@serenitynow1978 5 жыл бұрын
Dude, your vids kick ass++ Thorough, informative, concise This time we get all three Thank you for your time and efforts
@Debaser36
@Debaser36 Жыл бұрын
When I use precompiled headers, I always still write the includes in the cpp files and just comment them out :)
@mohabmohamed5846
@mohabmohamed5846 6 жыл бұрын
a cmake video please D:
@GfastGao
@GfastGao 6 жыл бұрын
Or say: Do this in a VS-Free way.
@VictorOrdu
@VictorOrdu 5 жыл бұрын
@@GfastGao VS currently integrates cmake
@lummwastaken
@lummwastaken 4 ай бұрын
You can add a PCH to a target in CMake using "target_precompile_headers" like so: target_precompile_headers( PUBLIC | PRIVATE | INTERFACE [["header_name_1.h"]] [["header_name_2.h"]] [["header_name_3.h"]] ...etc. ) Only works if you pass in a compiled library or executable target. You can also reuse precompiled headers in later targets using the following: target_precompile_headers( REUSE_FROM )
@lucifer9033
@lucifer9033 Жыл бұрын
this is awesome. thank you brother.
@AmeshaSpentaArmaiti
@AmeshaSpentaArmaiti 6 жыл бұрын
It hadn't occured to me that general C++ tutorials would still be coming alongside game engine tutorials. And I'm still learning new things. Why does c++ have so many "hidden" features? I've never heard of precompiled headers.
@Arganoid
@Arganoid 5 жыл бұрын
It's technically not a feature of C++. It's a feature of certain compilers such MSVC.
@Llourn
@Llourn 5 жыл бұрын
What an awesome series of videos! I reviewed the whole series from start to finish over the last 3 days and looking forward to starting the OpenGL series next! Thanks a million for the fantastic material.
@Mozartenhimer
@Mozartenhimer 4 жыл бұрын
Ahhhhhhhh Adding this to my project felt good. Every tutorial ever always says not to use PCH, probably just to avoid the complications, but man alive, it was nice pch to my personal projects. That plus enabling multiprocessing builds in VS took my clean build time to 2.2 seconds. Was 5.7 seconds before this. That means a lot to me. I just love to compile all the time.
@user-sl6gn1ss8p
@user-sl6gn1ss8p 3 жыл бұрын
hey, do you by any chance know how to enable multiprocessing from premake? I looked around but couldn't figure it out : / Nevermind, just found it, lol. In case anyone cares, it's very straightforward, just add: flags { "MultiProcessorCompile"}
@TheMrTape
@TheMrTape 6 жыл бұрын
Absolutely perfect. Thanks for doing this.
@pu3zle
@pu3zle 5 жыл бұрын
Just finished your C++ Course. I hope you'll keep posting more videos about C++ because I've learnt so much thanks to you. Don't abandon this series. :D
@hichamwarryor3547
@hichamwarryor3547 3 жыл бұрын
Thanks so much
@oualice9410
@oualice9410 5 жыл бұрын
Thank you, Cherno, for making those wonderful videos. You are benefiting people and contributing to a better world!
@agfd5659
@agfd5659 6 жыл бұрын
Maybe you could make a video about unity builds and the differences (positives, negatives) compared to the more common way of building programs.
@shavais33
@shavais33 4 жыл бұрын
Is there a way to use more than one precompiled header file in a MSVC++ project? It would be nice to separate the external headers that (almost) never change from internal headers that rarely change, but which do change from time to time. Then if/when I do have to change some rarely changed header, at least I wouldn't have to wait for all the external headers to recompile. Aside from combining translation units into one, are there any ways to further mitigate per translation unit compilation delays? I tend to end up with a ton of .h and .cpp files, and far more often than I'd expect, all or most of them end up getting recompiled when I run the build. In watching the compile, it definitely seems like there is a non-zero compile time cost associated with just having a translation unit at all, even if it has hardly anything in it. So I have this tendency to create "bundle" .h and .cpp files, that just #include a bunch of constituent .h and .cpp files, and then exclude those constituents from the build, so that way there are a lot fewer translation units to build. It definitely speeds up the build, but. I feel like there has to be a better way. Is there a good, succinct resource for reviewing the hows and wherefores of headerless C++ coding? Is there a good, succinct resource for reviewing the nuts and bolts of building Zero Overhead Abstractions? Recently I've been re-reading Bob Martin's book, Clean Code. One of the Big Ideas in it is to keep classes and functions really super small by dividing big ones up into smaller ones. I've tried that before, and I've kind of discarded the idea, because it seems like it's a lot more trouble than it's worth; but now that I have a lot more coding experience in general, I'm tempted to maybe re-approach it. But performance and efficiency are my foremost concerns, and build time is another big concern, and time spent coding tons of little classes and functions is another matter that kind of still gives me pause about it all. I think I need to better understand how I can - avoid having to maintain separate declarations/headers for every little constituent class and class member, - place their scopes into physical hierarchies (since named functions can't be nested in C++) without proliferating too many namespaces / long ns chains, - organize and control their individual scopes, both cognitively and in terms of their impact on the build, and - build zero-overhead abstractions. There's a fair bit that I already know about all that, but. If there isn't more to know than I know, then I guess I'm still kind of feeling like trying to really make super small classes and class members in the way Mr Martin talks about isn't really worth it in C++.
@tomaskot9278
@tomaskot9278 5 жыл бұрын
I was scared of precompiled headers and I've always disabled them in the project settings. Now I see how simple they are in fact, so I'm definitely going to give them a try. Thank you very much!
6 жыл бұрын
I was searching for a way to speed up building my codes, and PCH will probably have a huge impact. Thanks again for the tips and tricks.
@HamzaHajeir
@HamzaHajeir 5 жыл бұрын
Perfect series, Thank you Cherno :) Can you make a video about async calls. I have an embedded systems background and because MCU's are single-threaded, async calls are used, thus presence of async libraries, I am interested in developing libraries i use by using async calls.
@ekhidnis
@ekhidnis 5 жыл бұрын
Phew, I've finished the series! Thank you a lot for sharing these and I wish you having a happy life there!
@kiocode
@kiocode 5 ай бұрын
i like the rabbit
@rdappel
@rdappel Жыл бұрын
I've been using them wrong for years lol. At my last job our tech lead had us throw everything in there. Having never really used them before, I didn't question it. Makes total sense now! Thanks for the video!
@AntonioNoack
@AntonioNoack 4 жыл бұрын
Hearing from them the first time, and I think they are great. It's a little sad, it's not done automatically by VS etc...
@marotonin7620
@marotonin7620 3 жыл бұрын
How can I add precompiled header file into a file inside subdirectory? if I use "../pch.h" it won't recognize it it needs to be "pch.h"
@razvanfilea8076
@razvanfilea8076 6 жыл бұрын
I think he said "Right?" about 40 times lol
@Puffadderr
@Puffadderr 6 жыл бұрын
Right
@rcookie5128
@rcookie5128 6 жыл бұрын
Right!
@Saboteur709
@Saboteur709 6 жыл бұрын
I don't know if that's right. :)
@9100eric
@9100eric 4 жыл бұрын
lmao that's very close, he actually said it 59 times (at least that's in the transcript)
@JacobWrecker
@JacobWrecker 4 жыл бұрын
Right
@UlyssesAza
@UlyssesAza 4 жыл бұрын
This is genuinely a great video thanks a lot.
@chuthetai3011
@chuthetai3011 6 жыл бұрын
Thanks a lot 😁
@kvitnat
@kvitnat 4 жыл бұрын
never even heard about that i m a last year CS student from Ukraine and i just got my first job as c++ programmer and i'm pretty sure i wouldn't have passed all the tests and the interview if it wasn't for your c++ videos thanks a lot)
@lnx648
@lnx648 3 жыл бұрын
Potentially stupid question: if I add a lot of files into the the precompiled header, and then I include the pre compiled header, am I not including a lot of potentially useless code into every file of my project and yes speeding up the compile time but also increasing the final executable file size? Will turning off precompiled headers for say a release build make the compiler ignore included files that are not being used, therefore I can expect a larger executable file during development, but a smaller executable in release? Or the difference in sizes is so minimal I can avoid caring at all, considering large projects too of course.
@foomoo1088
@foomoo1088 2 жыл бұрын
I don’t use them for the reasons mentioned . I like keeping track of my dependencies, don’t use STL, and use a “game module” approach. True, my project is not super big yet but so far the modular design and limiting dependencies gives quick compile times.
@foomoo1088
@foomoo1088 2 жыл бұрын
Unreal engine also moved to the “include what you use” philosophy a while ago (similar approach in my personal engine)
@thoaxm6687
@thoaxm6687 Жыл бұрын
@@foomoo1088 CMake's target_precompile_headers() force includes the PCH into the translation units so source files can stay the "include what you use" way. (Still means you shouldn't bloat the PCH with absolutely everything, of course).
@drop0ne_f20
@drop0ne_f20 2 жыл бұрын
0:04 Hello The Cherno! Welcome back to my PC. :) LOL I made a funny! FYI I am aware I am not funny but that will never stop me :)
@laszlopaal9104
@laszlopaal9104 5 жыл бұрын
Can you please add video on how to write cache friendly code in C++? Bad and good design examples would be great.
@adamhendry945
@adamhendry945 Жыл бұрын
Can you please also do a video on the pIMPL idiom/method and on alignment and padding?
@thatrandompalmtreeyousawon2068
@thatrandompalmtreeyousawon2068 3 жыл бұрын
Man after following this series for a while I'm confident that I can get to building my first game in C++ soon
@marcpanther7924
@marcpanther7924 6 жыл бұрын
I love the People's Elbow gesture in the beginning
@MeeroSom
@MeeroSom 3 жыл бұрын
This is 2021, August, I have never heard before about precompiled headers... Thank you for introducing them though, this is as if I would already be a kind of a member of a kind of a learning company, and you as a kind of senior co-worker explain the tricks of the old foxes. As if.
@georgea2835
@georgea2835 2 жыл бұрын
Stupid arm thing at the beginning of the videos is everything
@郑祺瑞
@郑祺瑞 5 жыл бұрын
Thanks, cherno! We are finsihed this courses!
@electroturi
@electroturi 5 жыл бұрын
Can you have several pre-compiled headers in one project? Maybe like that you can pre-compile external dependencies in one PCH and then have your own code (or part of it) in a different PCH. This could be useful, no?
@benhetland576
@benhetland576 4 жыл бұрын
@electroturi Yes, you can have several pch in the same project, but perhaps not in the way you are thinking. AFAIK in Visual Studio you can only make use of one pch in each cpp file. There is a caveat too, and that is that the #include "pch.h" must be the first effective codeline in that cpp file. Everything before that line is actually completely ignored by the compiler! If the lines are just comments, that's no problem of course, but if you accidentally put something else important there, you will eventually be bitten ... My guess is that the implementation is simply such that the compiler just loads its entire internal state from the pch, then continues compiling from the line after the include pch.h. Whether it is similar in g++ and clang, I don't know, but that would be the reason you cannot load several pch in the same cpp with MSVC at least.
@澳洲程序员大卫
@澳洲程序员大卫 4 жыл бұрын
Well explained, thanks!
@feraudyh
@feraudyh 5 жыл бұрын
Best explanation I have ever seen.
@mrinmoybanik5598
@mrinmoybanik5598 2 жыл бұрын
Can you make a video on how to precompile .hpp headers from command prompt?
@baconsledge
@baconsledge 5 жыл бұрын
Excellent video series!
@mohammedbadaway7490
@mohammedbadaway7490 4 жыл бұрын
Thank you
@mihirluthra7762
@mihirluthra7762 4 жыл бұрын
Glad I came across your channel :)
@ajinkyax
@ajinkyax 3 жыл бұрын
is there a way to do same with a CMake project ? Those properties you showed wont open in Visual Studio 2019 for a CMake project.
@samziggler7837
@samziggler7837 4 жыл бұрын
New to me, it's a go for it to me
@jeroenkoffeman9402
@jeroenkoffeman9402 4 жыл бұрын
Am I missing something? What about the header files? If I can only include precompiled headers in the source file, then how do I declare any of those types in a header file? i.e: If I include and in pch.h, how can I declare a vector in any of my header files? Thanks in advance!
@jeroenkoffeman9402
@jeroenkoffeman9402 4 жыл бұрын
Or I guess the #pragma once ensures that it doesn't need to compile these headers from my header file. So i can just still include them in my header file one by one. During compiling the source file will include the pch.h first, so it will never include them from my custom header file. Am I right?
@Tel29767
@Tel29767 5 жыл бұрын
Love your series. Could you do a video on file input/output at some point as well please?
@simonmarchand1818
@simonmarchand1818 6 жыл бұрын
Hi Cherno, do you work on unreal engine and will you do some video about it ? Thx for this C++ series as well as the game engine one, it is very useful in my studies.
@kplays_6000
@kplays_6000 6 жыл бұрын
No, he doesn't
@esben181
@esben181 6 жыл бұрын
I believe Udemy have some excellent courses on that topic if you are willing to spend a few bucks.
@kplays_6000
@kplays_6000 6 жыл бұрын
@@esben181 Don't bother with Udemy, just look around on KZbin and use the official tutorials, there's plenty of free content out there.
@shaunyitisme3293
@shaunyitisme3293 6 жыл бұрын
@@esben181 Thx but I just like the quality of Cherno's video and wanted to know about future projects.
@jcdentonunatco
@jcdentonunatco 6 жыл бұрын
The Unreal C++ course on Udemy by Ben Tristem is really good, and very cheap, I definitely recommend it.
@veeecos
@veeecos 5 жыл бұрын
Could you please do a video on custom data structures next ?. I know you had mentioned them a while ago.
@DaveChurchill
@DaveChurchill 6 жыл бұрын
I was really hoping that you would somehow put this into the premake file, that would be awesome
@michaelpacheco7421
@michaelpacheco7421 5 жыл бұрын
Waiting for more videos! CMake is a good choice.
@carlodiferrante9577
@carlodiferrante9577 6 жыл бұрын
What about compiler cache? looks like a simpler and more ffective solution.
@HiAdrian
@HiAdrian 5 жыл бұрын
Yes, I think a compiler cache is a much better solution!
@omar_alzeer
@omar_alzeer 2 жыл бұрын
You are a legend !!
@Arganoid
@Arganoid 5 жыл бұрын
They used to lead to project folders taking up huge amounts of disk space (in Visual Studio, at least) - eg a simple Hello World app could take up gigabytes. Is this still the case?
@dijkstra4678
@dijkstra4678 2 жыл бұрын
very informative
@Xx_McJasper_xX
@Xx_McJasper_xX 3 жыл бұрын
First time I've heard of it. This is one of the problems with university education. You learn tons of theory but never hear about the practical tools/tips/tricks that professionals actually need.
@scottnivens9936
@scottnivens9936 3 жыл бұрын
Why am I learning about PCH's only now?! I managed to reduce the time for a full compile by >75%! WOW! Thanks!
@abdulelahaljeffery6234
@abdulelahaljeffery6234 6 жыл бұрын
compiling .h file with clang++ gives a warning: clang-6.0: warning: treating 'c-header' input as 'c++-header' when in C++ mode, this behavior is deprecated [-Wdeprecated] .hpp compiles fine.
@lazyh0rse
@lazyh0rse Жыл бұрын
I keep getting "unexpected end of file while looking for precompiled header. Did you forget to add '#include "pch.h"' to your source?" to all my cpp files, I did exactly as the video did, cleaned project. Still not working. Turning it off make compilation successful. Any help?
@huiguo1489
@huiguo1489 4 жыл бұрын
I wonder how to use this trick in a CMake project. Is there an example?
@xrafter
@xrafter 4 жыл бұрын
I have make that work will but cmake i don't know
@gowtham236
@gowtham236 4 жыл бұрын
Didn't know about this feature.
@victorz7748
@victorz7748 2 жыл бұрын
This is definitely a looooooooooooooooong hello world 13:29
@anthonyhalim926
@anthonyhalim926 6 жыл бұрын
Would love to see a video about typedef, typename, and using keywords! Love the videos
@CreativeOven
@CreativeOven 6 жыл бұрын
i love precompiled headers i hate waiting when compiling
@xingsir
@xingsir 5 жыл бұрын
Thank you. I really like this kind of video. Please more :)
6 жыл бұрын
Make a video about set and unordered_set in C++. I need them for a project at my university. Especially how to implement them for a custom class/structure. Or, maybe give me a good source from where to learn this, because I've had hard times trying to implement unordered_set for my custom structure.
@a_cats
@a_cats 7 ай бұрын
Clangd complains that I'm not using the header directly, should I just disable that warning or is there a standard way to deal with this? The fact that it's warning at all makes me feel like there's a convention for pchs that I'm not aware of
@shikharchaudhary6984
@shikharchaudhary6984 5 жыл бұрын
amazing video
@Automatyk
@Automatyk 6 жыл бұрын
Hi, what is with my project... I setup all like you and VS gives me a linking error: "LNK1104 cannot open file 'Debug\pch.obj'". Any solves?
@h.hristov
@h.hristov 5 жыл бұрын
Cover move semantics next yes
@AustinJerry
@AustinJerry 5 жыл бұрын
Hey, Cherno can you make a video on maps?
@brod515
@brod515 6 жыл бұрын
Wow! I knew there was search a thing as pre-compiled headers just didn't really know what they did.
@mul7522
@mul7522 6 жыл бұрын
Is it only the template stuff that is included that needs to be compiled? If you don't include template headers and only have regular ones then it doesn't need to compile the header?
@Stygianstevedore
@Stygianstevedore 5 жыл бұрын
How do precompiled headers interact with something like ccache, which tracks compiled objects and keeps you from having to recompile unchanged files? Do they do basically the same thing?
@jeroenkoffeman9402
@jeroenkoffeman9402 4 жыл бұрын
Will the compiler automatically only include the code that the sourcefile actually uses? Otherwise, wouldn't precompiled headers make your program larger? Because it adds all the includes to every source file, instead of only the necessary ones for that specific source file. Thanks in advance
@billbasener8784
@billbasener8784 2 жыл бұрын
Another great video. I can precompile headers and my main.cpp compiles fast now from the command line, but when I compile it in VS code, which seems to just use my command line call, it takes a very long time. Anyone know why?
@yellowlegend245
@yellowlegend245 5 жыл бұрын
another question, 1. cant we have different pch.h file for different projects 2. i see it makes difference on development time, does it have any performance on final executables also? or is that same No need to say, that your explanation is awesome, better than many classroom teachers.
@norb3695
@norb3695 Жыл бұрын
19:10 how did that thing generate 117 megabytes in such a small time what???
@hiraasif4227
@hiraasif4227 4 жыл бұрын
When are you going to make video on "File Handling in C++" , I can't find any fruitful video on that! Please make a video on that!! Moreover , I just love the way you explain things and you are really my teacher now a days. I have my final tomorrow of OOP, and will pass it just because of you! Thank You Sooooo Much! Have a Nice Day!
@kalelalves
@kalelalves 2 жыл бұрын
Before anything... Amazing videos. I love the way you explain stuff man. You're really good at that. 11:50 i know this is pretty old, and I agree that PCHs area must for those kinds of libs, but dude, you keep saying you don't want to recompile it everytime, regarding the STL... And that not entirely false, cause you end up recompiling symbol references you use and parsing the h files into your translation unities,, but the library is already compiled in the c++ runtime, or other libs/DLLs you use. So it's also not all true that you end up recompiling all that stuff. If you would have to, then you would see the amount of time that that takes, it's absurdly larger and longer than just parsing headers... That's one of the main header/source separation reasons. Unless off course you use some bad lib that needless defines a lot of stuff in headers. I'm certain that you know all that, but saying that might be confusing for the people that does not have good knowledge about c++ or linking in general and possibly give them a bad ideia of what that whole system actually does. I just think that it's something that should be mentioned, although, I'm not as good at teaching as you are, so I might be wrong as well haha, and this is something people shouldn't have to know at first, like how you get to physics formulas when you first learns physics cause you have no idea of integral calculus, limits, and so actually is. I still think it should though. 😂
@TheDezmen3
@TheDezmen3 3 жыл бұрын
But what about .h files that have vectors/maps etc elements if pch.h is included in .cpp file
@esben181
@esben181 6 жыл бұрын
A video in the middle of the week! What an amazing surprise :D Thank you
@jeffvenancius
@jeffvenancius Жыл бұрын
What if I create Macros to include the headers I need, but only on release? Is that possible?
@nullnull6032
@nullnull6032 4 жыл бұрын
very cool
Dynamic Casting in C++
13:59
The Cherno
Рет қаралды 118 М.
BETTER Header Files and Preprocessor Debugging
24:26
The Cherno
Рет қаралды 74 М.
Long Nails 💅🏻 #shorts
00:50
Mr DegrEE
Рет қаралды 18 МЛН
Миллионер | 3 - серия
36:09
Million Show
Рет қаралды 2,2 МЛН
How Much Tape To Stop A Lamborghini?
00:15
MrBeast
Рет қаралды 248 МЛН
C++ Header Files
15:10
The Cherno
Рет қаралды 737 М.
"Clean" Code, Horrible Performance
22:41
Molly Rocket
Рет қаралды 912 М.
why do header files even exist?
10:53
Low Level
Рет қаралды 433 М.
SOME UNIQUE C++ CODE! // Pacman Clone Code Review
26:42
The Cherno
Рет қаралды 288 М.
Harder Than It Seems? 5 Minute Timer in C++
20:10
The Cherno
Рет қаралды 220 М.
I did a C++ University Assignment
50:23
The Cherno
Рет қаралды 299 М.
BENCHMARKING in C++ (how to measure performance)
14:52
The Cherno
Рет қаралды 159 М.
Is this the WORST CODE I've EVER SEEN? // Code Review
24:28
The Cherno
Рет қаралды 81 М.
Compilers, How They Work, And Writing Them From Scratch
23:53
Adam McDaniel (kiwi)
Рет қаралды 224 М.
Long Nails 💅🏻 #shorts
00:50
Mr DegrEE
Рет қаралды 18 МЛН