C/C++ Compilation of a header file in c++

  • Thread starter Thread starter krishna mohan
  • Start date Start date
  • Tags Tags
    C++ File
AI Thread Summary
When using the #include directive in C++, the header file's content is copied into the main program's source file before compilation. This means that the header file does not need to be compiled separately; it is compiled together with the main program. This process simplifies the compilation of programs that rely on multiple header files, as they are integrated into the source file during the compilation stage.
krishna mohan
Messages
114
Reaction score
0
Hi..am just learning c++...i have a doubt..

Suppose you have a header file and you include it in your main program by using the #include directive..then do you have to compile the header file separately? Or does it get compiled with the main program?
 
Technology news on Phys.org
krishna mohan said:
Or does it get compiled with the main program?
Yes, all the #include does is copy the text of the header file into the .cpp file before passing it to the compiler
 
I guess your yes means that one does not have to compile a header file separately...and it gets compiled with the main program..?
 
I understand..thank you..
 
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...
Back
Top