Click here to Skip to main content
15,912,329 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
AnswerRe: Basic doubt with Class template Pin
Bram van Kampen19-Aug-11 14:54
Bram van Kampen19-Aug-11 14:54 
Your basic problem appears to be to understand how Header Files, cpp Files, the Compiler and the Linker work.

First the Compiler. The Compiler builds an Object File. This is a Binary representation of a cpp File. It containd the CPP Code you wrote, converted to machine code as well as a whole raft of information needed later. The Compiler contains a thing, called a Pre-Processor. It prepares your CPP file before actual compilation. Conceptually it produces a New Source File. It copies your file Line by Line. but if it finds a statement like #include "MyBeautifulHdr.h", it does not copy the include statement, but, instead writes the entire contents of "MyBeautifulHdr.h" at the location of the '#include' statement. When it encounters a #define FOO 1 statement, it undertakes to replace henceforth every future occurrence of 'FOO' with 1. It goes on like that at infinitum, and the final file offered to the compiler has all '#includes, #defines, #if's etc resolved.
At that stage the compiler does not know ( and does not care) from what file what item came from, (except for error reporting). It just builds the Object File, (if it Can)
if it cannot, you get an error.

Each of the Object Files generated roughly correspond to the code you wrote in a cpp file.

An extern declaration is a promise to the compiler that somewhere in an other file or library, an item of that specification exists.

The Linker tries to build an executable out of all those object files. In doing so, it may also include Object files written by others, e.g. those written by Microsoft, which came with your compiler package. To make that process more efficient, multiple obj files can be gathered together into a library (.lib) file
If the linker cannot find a named item, or, finds more than one, the linker will fail building the executable.

Getting a Full understanding of how your tools work will answer your queery.

regards,
Smile | :)
Bram van Kampen

Questionbackgroud worker thread crashes but fine when foreground Pin
VeganFanatic26-Jun-11 4:44
VeganFanatic26-Jun-11 4:44 
AnswerRe: backgroud worker thread crashes but fine when foreground Pin
Richard MacCutchan26-Jun-11 5:18
mveRichard MacCutchan26-Jun-11 5:18 
GeneralRe: backgroud worker thread crashes but fine when foreground Pin
VeganFanatic26-Jun-11 5:19
VeganFanatic26-Jun-11 5:19 
GeneralRe: backgroud worker thread crashes but fine when foreground Pin
Richard MacCutchan26-Jun-11 5:44
mveRichard MacCutchan26-Jun-11 5:44 
GeneralRe: backgroud worker thread crashes but fine when foreground Pin
VeganFanatic26-Jun-11 5:46
VeganFanatic26-Jun-11 5:46 
GeneralRe: backgroud worker thread crashes but fine when foreground Pin
Richard MacCutchan26-Jun-11 5:57
mveRichard MacCutchan26-Jun-11 5:57 
GeneralRe: backgroud worker thread crashes but fine when foreground Pin
VeganFanatic26-Jun-11 5:58
VeganFanatic26-Jun-11 5:58 
GeneralRe: backgroud worker thread crashes but fine when foreground Pin
Richard MacCutchan26-Jun-11 6:06
mveRichard MacCutchan26-Jun-11 6:06 
GeneralRe: backgroud worker thread crashes but fine when foreground Pin
VeganFanatic26-Jun-11 6:08
VeganFanatic26-Jun-11 6:08 
AnswerRe: backgroud worker thread crashes but fine when foreground Pin
Albert Holguin5-Jul-11 9:52
professionalAlbert Holguin5-Jul-11 9:52 
AnswerRe: backgroud worker thread crashes but fine when foreground Pin
Paul M Watt10-Jul-11 16:24
mentorPaul M Watt10-Jul-11 16:24 
QuestionMigration from MFC to STL Pin
hrishi32122-Jun-11 20:28
hrishi32122-Jun-11 20:28 
AnswerRe: Migration from MFC to STL Pin
Alain Rist22-Jun-11 22:44
Alain Rist22-Jun-11 22:44 
GeneralRe: Migration from MFC to STL Pin
hrishi32126-Jun-11 18:28
hrishi32126-Jun-11 18:28 
GeneralRe: Migration from MFC to STL Pin
Alain Rist26-Jun-11 21:18
Alain Rist26-Jun-11 21:18 
AnswerRe: Migration from MFC to STL Pin
Albert Holguin23-Jun-11 8:44
professionalAlbert Holguin23-Jun-11 8:44 
GeneralRe: Migration from MFC to STL Pin
hrishi32126-Jun-11 18:30
hrishi32126-Jun-11 18:30 
AnswerRe: Migration from MFC to STL Pin
Bram van Kampen19-Aug-11 15:00
Bram van Kampen19-Aug-11 15:00 
QuestionQuestion about inserting into dbf file Pin
monsieur_jj21-Jun-11 16:08
monsieur_jj21-Jun-11 16:08 
QuestionToolTip text in WTL Pin
SelvaKr20-Jun-11 21:03
SelvaKr20-Jun-11 21:03 
AnswerRe: ToolTip text in WTL Pin
Cool_Dev21-Jun-11 0:31
Cool_Dev21-Jun-11 0:31 
AnswerRe: ToolTip text in WTL Pin
Alain Rist21-Jun-11 4:29
Alain Rist21-Jun-11 4:29 
QuestionCompiler Warning C4407: How bad is it? Pin
Kyudos19-Jun-11 18:03
Kyudos19-Jun-11 18:03 
AnswerRe: Compiler Warning C4407: How bad is it? Pin
Richard MacCutchan19-Jun-11 22:20
mveRichard MacCutchan19-Jun-11 22:20 

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.