Click here to Skip to main content
14,869,978 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Multiple .cpp files Pin
gamefreak22915-Apr-10 22:31
Membergamefreak22915-Apr-10 22:31 
GeneralRe: Multiple .cpp files Pin
Cedric Moonen5-Apr-10 22:41
MemberCedric Moonen5-Apr-10 22:41 
GeneralRe: Multiple .cpp files Pin
gamefreak22915-Apr-10 22:49
Membergamefreak22915-Apr-10 22:49 
AnswerRe: Multiple .cpp files Pin
KarstenK5-Apr-10 22:38
mveKarstenK5-Apr-10 22:38 
GeneralRe: Multiple .cpp files Pin
gamefreak22915-Apr-10 22:45
Membergamefreak22915-Apr-10 22:45 
GeneralRe: Multiple .cpp files Pin
KarstenK5-Apr-10 22:59
mveKarstenK5-Apr-10 22:59 
GeneralRe: Multiple .cpp files Pin
gamefreak22915-Apr-10 23:40
Membergamefreak22915-Apr-10 23:40 
GeneralRe: Multiple .cpp files Pin
Emilio Garavaglia6-Apr-10 2:20
MemberEmilio Garavaglia6-Apr-10 2:20 
gamefreak2291 wrote:
I know it processing the c++ code, converts it into machine code, creating object files, and then links them into the executable


gamefreak2291 wrote:
The thing I did not understand was how the final product would run if there were multiple sources


This is a contradiction...
You miss some aspects of the first point that makes you not having a proper understanding the second.

I try to summarize in brief:

- Each cpp file is a set of declaration that can be either object instances (aka "global variables") or function ("sequence of expressions and statements") each having a name.
Some of those declaration are "external" other "internal" (by default, functions are "external", tgat means "visible outside the file they are in")

- The translation the compiler does on each cpp file produces obj files where code is translated into machine code, and where external names are mapped in a symbol table.

- The linker peeks all the obj-s and libraries and resolve the mapped names with their respective references they have.
To let this process to succeed, all linked names must be unique (or mangled as such).
One of the names (corresponding to the main function)is then mapped in the exe file as the "applicaion entry point" (well, not exacly, the entry point is an internally CRT initializer that calls main at the end...) so that when the operating system loads the application the execution will start from there.

If you follow these three steps, there is no reason why your question should take place.
The program flows in the way the various functions reciprocally call each other. No matter where they originally came from.
There is no "parallelism" in a C++ classic program.

2 bugs found.
> recompile ...
65534 bugs found.
D'Oh! | :doh:


GeneralRe: Multiple .cpp files Pin
gamefreak22916-Apr-10 6:47
Membergamefreak22916-Apr-10 6:47 
GeneralRe: Multiple .cpp files Pin
Emilio Garavaglia6-Apr-10 20:36
MemberEmilio Garavaglia6-Apr-10 20:36 
QuestionPermutations with repetition Pin
MsmVc5-Apr-10 20:59
MemberMsmVc5-Apr-10 20:59 
AnswerRe: Permutations with repetition Pin
CPallini5-Apr-10 21:49
mveCPallini5-Apr-10 21:49 
GeneralRe: Permutations with repetition [modified] Pin
MsmVc5-Apr-10 21:58
MemberMsmVc5-Apr-10 21:58 
GeneralRe: Permutations with repetition Pin
CPallini5-Apr-10 22:06
mveCPallini5-Apr-10 22:06 
GeneralRe: Permutations with repetition Pin
MsmVc5-Apr-10 22:07
MemberMsmVc5-Apr-10 22:07 
GeneralRe: Permutations with repetition Pin
MsmVc6-Apr-10 0:00
MemberMsmVc6-Apr-10 0:00 
GeneralRe: Permutations with repetition Pin
CPallini6-Apr-10 0:21
mveCPallini6-Apr-10 0:21 
GeneralRe: Permutations with repetition Pin
MsmVc8-Apr-10 0:42
MemberMsmVc8-Apr-10 0:42 
GeneralRe: Permutations with repetition Pin
CPallini8-Apr-10 3:25
mveCPallini8-Apr-10 3:25 
QuestionCFile Dialog Crash on Window Server 2008. Pin
Le@rner5-Apr-10 18:22
MemberLe@rner5-Apr-10 18:22 
AnswerRe: CFile Dialog Crash on Window Server 2008. Pin
KarstenK5-Apr-10 22:42
mveKarstenK5-Apr-10 22:42 
GeneralRe: CFile Dialog Crash on Window Server 2008. Pin
Le@rner7-Apr-10 20:49
MemberLe@rner7-Apr-10 20:49 
GeneralRe: CFile Dialog Crash on Window Server 2008. Pin
KarstenK7-Apr-10 22:38
mveKarstenK7-Apr-10 22:38 
QuestionStack overflow Pin
browneyes865-Apr-10 16:00
Memberbrowneyes865-Apr-10 16:00 
QuestionRe: Stack overflow Pin
David Crow5-Apr-10 16:31
MemberDavid Crow5-Apr-10 16:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.