I love that you jump right into it... it seems like all the most viewed or liked videos start off with trying to sell something and i cant stand that..
Really thank you for these tutorials, I'm starting with competitive programming and I wanted to use c++ and suddenly I saw these videos and they really helped me.
Finally i found a video that explain what header is and not make me watch 30 minutes video hoping to hear or get a hint of what header is ! THANK YOU VERY MUCH!
I wasted 3 days looking for a fix on how to include user-made header files, it always caused a linker error in VS Code, can't thank you enough for this video mate :)
still does not work, it says main.exe is not recognized! vscode and c++ is the hardest config that I have done in my life, 4 hours watching videos cannot get a damn hello world + another class set up. And are you telling me that I have to run the command "g++ -o main.exe main.cpp includes/mynewclass.cpp" every time I create a new class???
how did you compilie with g++ -o main.exe main.cpp includes/calculations.cpp commanad?! is not working for me, it works with g++ main.cpp includes/calculations.cpp -o main.exe. What I am missing here? Is there a way to configure Compile Run "F6" command to work with includes?
Thank you very much for the video, I'm from Brazil and only used C ++ in VS2019, and this video helped me to understand how to compile headers files. I will follow more videos from your Channel
Thank you so much! I am also using the extension and yesterday we started learning about header files and I was wondering what was I doing wrong. I found from internet which file what should it contain but I could not find why it was not compiling.
So, linker identify the implementation of the declaration just by the same filename? What about include guard i learned in C. its not relevant anymore?
for this problem in VS code : The term 'g++' is not recognized as the name of a cmdlet, function,.... solution : ruclips.net/video/5hSRaW4swto/видео.htmlsi=zzxcLPnKLhjL0cP3
How can I make a header file with its imolementation file that can be included and used across any cpp filed without explicitly including it to your project ? Just like C++ header files (iostream, vector, etc)
So is there any way to get Visual Studio Code to do this for me? I have to jump to the terminal every time, as Visual Studio doesn't recognize it at all. At that point I'm much better off just using Vim.
The only reason why his C++ code works is that it's afraid of his biceps an getting punched 😹😼 but jokes aside, very good explanation, really helped me out!
what would be the command line in the case I have multiple header files? Do I have to write every single one? or is there a way to compile the whole folder "includes"?
Is there any way to run (or execute) the main code(main.cpp) without typing a command such as "g++ -o main.exe main.cpp calculations.cpp"? In Visual Studio (not VS Code), it allows to users to have a class with its header file(.h) and definition file(.cpp) and run it without any single special terminal command, as long as all the files are in the project folder. It seems like VS Code does cannot find the header file's directory on its own.
Why can't gcc implicitely fetch all the needed files? Why can't you declare what's made visible outside the .cpp file without using a .h file, but by using a "export" keyword for example?
for this problem in VS code : The term 'g++' is not recognized as the name of a cmdlet, function,.... solution : ruclips.net/video/5hSRaW4swto/видео.htmlsi=zzxcLPnKLhjL0cP3
A bad practice but it really works, actually that is the only one that worked for me, I could't made work the one with the header file. I am working with C in VSC. But well at least one way worrked for me. Greetings.
for this problem in VS code : The term 'g++' is not recognized as the name of a cmdlet, function,.... solution : ruclips.net/video/5hSRaW4swto/видео.htmlsi=zzxcLPnKLhjL0cP3
I'm currently using arduino IDE software,but when I'm trying to upload the coding,there are some error and it show a message 'no header files (.h) ' What should i do? Anyone help me please? I really need your help.
Thank you for explaining the h vs cpp thing, i.e. being able to hide the actual functions in cpp. I didn't understand why the boilerplate was duplicated... it was driving me nuts!
the .h file is like a contract to the end user. and they are not duplicated cuz the .h file have the declaration methods and the .cpp file must have the definition of that methods.
For the most part I believe it never really matters how you name stuff you just need to be consistent with it. My intro to c++ professor will have the header file's class as the title. You just need to make sure that you type it out exactly the way you named the file when you go to include it in the source file
After creation of main.exe Include your header file in calculation.cpp file i.e #include"calculation.h" And then in main.cpp makes changes of #include "Includes/calculation.h" After that in new terminal Write g++ -o main.exe main.cpp Includes/calculation.cpp Hit enter And then write main.exe It will give result
@@ASHISHKUMAR-gh1uu He has his calculations.h file in a folder called includes, so "includes/calculations.h" is the path to the calculations.h file. If your calculations.h file is in the same folder as your main.cpp file you only need to have #include "calculations.h"
I am confused. I thought that a header file is MyFile.h and a c++ file is MyFile.cpp. Looks like you are just creating another c++ file and doing an include. How it that a header file? And isn't c++ OOP? Why no classes? PS. I am a C# :)
It happens under the hood cuz of the naming conventions. all you need to know is your xxxx.cpp file that have the implementation of the logic must have a xxxx.h file with the exact name that acts like an interface for the users. Now inject the xxxx.h not the xxxx.cpp that must be private.
I still don't get why you would use header files if you can use the cpp instead, you are not hiding your source code using h files the implementation in cpp files shows all the files there.
Okay, so I don't usually comment on videos but this annoyed the hell out of me so I am going to comment if someone else has the same issue If everything works up till the point where he types main.exe and then it just shows you an error message, make sure you are using command prompt as your terminal, or use the equivalent command in your terminal Great video tho! 👍 (edit: just some punctuation)
Thanks a lot :) your explanation did help me!. I am trying to use both g++ and cl compiler and I just follow your example using "cl /Zi /EHsc /nologo /Fe:main.exe main.cpp Random1.cpp" in powershell from the working directory. And that's work!
gosh, why it's so difficult, too many perplexed frameworks you guys just need to switch to VS (purple one) and then you will see it much much easier, just "pragma once" and then everything is on the set
so instead of including calculation.cpp you include calculation.h. And the only use for a header file is to make the code more readable by moving the logic back to a second file. Why does it feel like using a sledgehammer on a mosquito? As if back in the days when C was invented "readability" was on the menu. I bet there is a better reason why header files exist. I'll go look it up.
I love that you jump right into it... it seems like all the most viewed or liked videos start off with trying to sell something and i cant stand that..
then sit dow-
Love your teaching style! I always learn something new when you post a new video!
appreciate it :)
@@NeuralNine how does one run one of these .h files thanks :)
Really thank you for these tutorials, I'm starting with competitive programming and I wanted to use c++ and suddenly I saw these videos and they really helped me.
How do you configure this include in the tasks.json file if you dont want to do it from command line ?
Finally i found a video that explain what header is and not make me watch 30 minutes video hoping to hear or get a hint of what header is !
THANK YOU VERY MUCH!
This video was very clear and amazingly explained. Learnt a lot! Thank you.
you have no idea how long i spent trying to figure out how to use the header file tysm
The header feels like an Interface. Nice tutorial
I wasted 3 days looking for a fix on how to include user-made header files, it always caused a linker error in VS Code, can't thank you enough for this video mate :)
still does not work, it says main.exe is not recognized! vscode and c++ is the hardest config that I have done in my life, 4 hours watching videos cannot get a damn hello world + another class set up. And are you telling me that I have to run the command "g++ -o main.exe main.cpp includes/mynewclass.cpp" every time I create a new class???
I'm wondering this too...
Thank u so much. I was having problem with a function that was being undefined, and you just saved me😃
how did you compilie with g++ -o main.exe main.cpp includes/calculations.cpp commanad?! is not working for me, it works with g++ main.cpp includes/calculations.cpp -o main.exe. What I am missing here? Is there a way to configure Compile Run "F6" command to work with includes?
Thank you, very well explained!
here I found what I was looking for, a very good video. Thank you bro!
Hi, is there a way to edit the task.json to include something like "include/*.cpp" to compile everything with F5?
Any update to this inquire?
@@Aikocake Unfortunately not
@@ebiscaia Have you found a solution yet?
@@RosinenbomberPilot nope, mate. It’s been a while I don’t use C++
@@ebiscaiabruh, one would say it is one of the most basic things a programmer can do. I'll never stop hating this system
Thank you very much for the video, I'm from Brazil and only used C ++ in VS2019, and this video helped me to understand how to compile headers files. I will follow more videos from your Channel
Nice video man! I spent hours trying to find a work around for CMake, and this cleared it up in like 5 mins! You rock!
but what if you have 5 different headers that you use for 5 different things at compile do you have to also specify the other 5 different .cpp files ?
Thats where
#pragma once
Comes into play
Thank you so much! I am also using the extension and yesterday we started learning about header files and I was wondering what was I doing wrong. I found from internet which file what should it contain but I could not find why it was not compiling.
Wow,Thank you you made me to come out confusion of running c++ with the header files.
Great vid!
thanks :)
Great tutorials bro, refreshed my c++ quick and good w this series
I have a question, what about the #ifndef, #define and #endif in the header file
Its a best practice for files validation
So, linker identify the implementation of the declaration just by the same filename? What about include guard i learned in C. its not relevant anymore?
You explained it very simply and clearly. It couldn't have been explained better. Thanks
thank you man! youre best teacher for c++
How to run a project with a single header file and multiple source files?
thank you so much sir. I was facing issues with linking the files.
Help🥲 The command isnt working, i keep getting this error, cc1plus.exe: fatal error: main.cpp: No such file or directory
compilation terminated.
for this problem in VS code : The term 'g++' is not recognized as the name of a cmdlet, function,....
solution : ruclips.net/video/5hSRaW4swto/видео.htmlsi=zzxcLPnKLhjL0cP3
How can I make a header file with its imolementation file that can be included and used across any cpp filed without explicitly including it to your project ? Just like C++ header files (iostream, vector, etc)
Keep going! Really great method of teaching!
great video again like every time
what if you end up having to compile two files with two implementations of, say, the add function?
So is there any way to get Visual Studio Code to do this for me? I have to jump to the terminal every time, as Visual Studio doesn't recognize it at all. At that point I'm much better off just using Vim.
It's always better to use vim
In the next videos, you can enlarge the font a little to be clear because I am using the phone and thank you for the effort
This is really great, thanks for posting!
Thanks for the tutorial bruh! That's Amazing.
The only reason why his C++ code works is that it's afraid of his biceps an getting punched 😹😼 but jokes aside, very good explanation, really helped me out!
what would be the command line in the case I have multiple header files? Do I have to write every single one? or is there a way to compile the whole folder "includes"?
i have a same problem, did u find any solution?
does "not adding the .cpp file" directly have any importance in terms of privacy? i didn't get that?
believe me !!! You are the best for me !!!!! your method is great
Is there any way to run (or execute) the main code(main.cpp) without typing a command such as "g++ -o main.exe main.cpp calculations.cpp"?
In Visual Studio (not VS Code), it allows to users to have a class with its header file(.h) and definition file(.cpp) and run it without any single special terminal command,
as long as all the files are in the project folder.
It seems like VS Code does cannot find the header file's directory on its own.
The 'button' you press in Visual Studio is basically an automated implementation of compiling the source code (i.e using the terminal command)
BRO
just use visual studio
it is 100 times better
of course as an ide Not a code editior
@@hodayfa000h Agreed! Already swapped to VS!
@@syldris oh yeah this was 1 year ago of course it changed
Finally got it, thank you very much
Hi! How come i have .cpp file that uses stdio.h library and uses printf function?
Great video !!! very well explained
Thanks teacher this video was really helpful for me.
Nice video, months to searching this!!
thank you in 2nd class of programming and they taught this in the first one but i didn't pay attention in that lesson lmao
Thank u very much...... This video helped me alot... Thank u 🙏🙏
Nice vid, very clear, very helpful.
Why can't gcc implicitely fetch all the needed files?
Why can't you declare what's made visible outside the .cpp file without using a .h file, but by using a "export" keyword for example?
for this problem in VS code : The term 'g++' is not recognized as the name of a cmdlet, function,....
solution : ruclips.net/video/5hSRaW4swto/видео.htmlsi=zzxcLPnKLhjL0cP3
Great video, thank you so much for that!
A bad practice but it really works, actually that is the only one that worked for me, I could't made work the one with the header file. I am working with C in VSC. But well at least one way worrked for me. Greetings.
love it bro
love it
Thanks for your instruction! Very easy to understand and informative!
But what if I have 100 of those header files and cpp files? Should I add all of them to the g++ command?
#pragma once
wait you might have just saved my life
nope still not working
great video
thanks :)
Thankyou so much sir, really help full.
really well done thanks
for this problem in VS code : The term 'g++' is not recognized as the name of a cmdlet, function,....
solution : ruclips.net/video/5hSRaW4swto/видео.htmlsi=zzxcLPnKLhjL0cP3
i get 3 errors depending on my variables: 'x': identifier not found, 'y' undeclared identifier, and 'z': redefinition, multiple initialization
Hey, what is your intro? BGM
Sir can you make a obs studio with python
lmfao
xddd
What does this even mean?
I'm currently using arduino IDE software,but when I'm trying to upload the coding,there are some error and it show a message 'no header files (.h) '
What should i do?
Anyone help me please?
I really need your help.
And if i not notice someone reply my comment,kindly dm me at instagram. Tq in advance
Ig : nrlsy_hda
What is the keyboard?
Thank you for explaining the h vs cpp thing, i.e. being able to hide the actual functions in cpp. I didn't understand why the boilerplate was duplicated... it was driving me nuts!
the .h file is like a contract to the end user. and they are not duplicated cuz the .h file have the declaration methods and the .cpp file must have the definition of that methods.
@@rouisaek Good clarification!
Thanks
Why should the files have to have the same name?
They don't have to.
For the most part I believe it never really matters how you name stuff you just need to be consistent with it. My intro to c++ professor will have the header file's class as the title. You just need to make sure that you type it out exactly the way you named the file when you go to include it in the source file
tanks bro, you realy help me to
solve the compiler error
In my case it only worked with include "calculations.cpp" or include "calculations.h". with include "includes/calculations.cpp or .h" i got an error.
After creation of main.exe
Include your header file in calculation.cpp file i.e #include"calculation.h"
And then in main.cpp makes changes of #include "Includes/calculation.h"
After that in new terminal
Write
g++ -o main.exe main.cpp Includes/calculation.cpp
Hit enter
And then write
main.exe
It will give result
@@ASHISHKUMAR-gh1uu He has his calculations.h file in a folder called includes, so "includes/calculations.h" is the path to the calculations.h file. If your calculations.h file is in the same folder as your main.cpp file you only need to have #include "calculations.h"
Thx 4 your videos :)
I am confused. I thought that a header file is MyFile.h and a c++ file is MyFile.cpp. Looks like you are just creating another c++ file and doing an include. How it that a header file? And isn't c++ OOP? Why no classes? PS. I am a C# :)
Thank you so much.
for some computers, you can't run the "main.exe" command in the terminal, you need to rewrite it as ".\main"
thanks bro
thanks you❤
i didnt understand how the calculations.h had access to the calculations.cpp because u didnt inclue the cpp file in the header file
It happens under the hood cuz of the naming conventions. all you need to know is your xxxx.cpp file that have the implementation of the logic must have a xxxx.h file with the exact name that acts like an interface for the users. Now inject the xxxx.h not the xxxx.cpp that must be private.
You saved me thank you
Greetings from russia! and thank you for teaching me!
I still don't get why you would use header files if you can use the cpp instead, you are not hiding your source code using h files the implementation in cpp files shows all the files there.
Isn't this working as interfaces ??
Good, welcome to you.
Gracias a tu video encontré la forma de ejecutar los headers no lo encuentro en otros videos se me hace muy pesado el visual studio 2019 ty
dude,you are using the different version of microsoft visual studio that i use,probably that "most" people use
we use the community version
You should name your channel as Brainpods
very good
Okay, so I don't usually comment on videos but this annoyed the hell out of me so I am going to comment if someone else has the same issue
If everything works up till the point where he types main.exe and then it just shows you an error message, make sure you are using command prompt as your terminal, or use the equivalent command in your terminal
Great video tho! 👍
(edit: just some punctuation)
Thanks
why the last step is to type main.exe
🤩
Classes?
Can you livestream you coding some day :)
it's on my todo list. sooner or later I will do it :)
@@NeuralNine Ok thanks!
includes is not working for me
Thanks a lot :) your explanation did help me!. I am trying to use both g++ and cl compiler and I just follow your example using "cl /Zi /EHsc /nologo /Fe:main.exe main.cpp Random1.cpp" in powershell from the working directory. And that's work!
bro everybody is asking about several includes, i think that can be achieved with a makefile
gosh, why it's so difficult, too many perplexed frameworks
you guys just need to switch to VS (purple one) and then you will see it much much easier, just "pragma once" and then everything is on the set
so instead of including calculation.cpp you include calculation.h. And the only use for a header file is to make the code more readable by moving the logic back to a second file. Why does it feel like using a sledgehammer on a mosquito? As if back in the days when C was invented "readability" was on the menu. I bet there is a better reason why header files exist. I'll go look it up.
5:58 2:43
3rd
"no such file or directory"
Fuck this shit, honestly