Click here to Skip to main content
15,920,217 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: #pragma once, #ifndef problem Pin
werfel16-Dec-05 11:34
werfel16-Dec-05 11:34 
GeneralRe: #pragma once, #ifndef problem Pin
Shog916-Dec-05 12:20
sitebuilderShog916-Dec-05 12:20 
GeneralRe: #pragma once, #ifndef problem Pin
werfel16-Dec-05 14:55
werfel16-Dec-05 14:55 
GeneralRe: #pragma once, #ifndef problem Pin
Shog916-Dec-05 17:04
sitebuilderShog916-Dec-05 17:04 
GeneralRe: #pragma once, #ifndef problem Pin
Jörgen Sigvardsson18-Dec-05 9:02
Jörgen Sigvardsson18-Dec-05 9:02 
GeneralRe: #pragma once, #ifndef problem Pin
#realJSOP16-Dec-05 10:23
professional#realJSOP16-Dec-05 10:23 
GeneralRe: #pragma once, #ifndef problem Pin
werfel16-Dec-05 10:27
werfel16-Dec-05 10:27 
AnswerRe: #pragma once, #ifndef problem Pin
Nemanja Trifunovic16-Dec-05 10:56
Nemanja Trifunovic16-Dec-05 10:56 
The guards prevent compiler to read the header file multiple times, but if you have something defined (as opposed to declared) in a header file which is included from several cpp files, the guards cannot help you with that.

For instance if in your h file you have something like

int add (int a, int b) {return a + b;}


and include it from multiple cpp file, you'll get linker errors. To avoid it in this specific case, you'll need to declare the functionsl inline:

inline int add (int a, int b) {return a + b;}


and it should work fine.



My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
GeneralRe: #pragma once, #ifndef problem Pin
werfel16-Dec-05 11:04
werfel16-Dec-05 11:04 
GeneralRe: #pragma once, #ifndef problem Pin
Jörgen Sigvardsson16-Dec-05 12:26
Jörgen Sigvardsson16-Dec-05 12:26 
GeneralRe: #pragma once, #ifndef problem Pin
werfel16-Dec-05 14:47
werfel16-Dec-05 14:47 
GeneralRe: #pragma once, #ifndef problem Pin
Jörgen Sigvardsson16-Dec-05 23:15
Jörgen Sigvardsson16-Dec-05 23:15 
QuestionAudio pitch/time shift Pin
Hedphoniks16-Dec-05 9:58
Hedphoniks16-Dec-05 9:58 
QuestionC++ noob ?: Show a window in a DLL Pin
James Coleman16-Dec-05 9:53
James Coleman16-Dec-05 9:53 
QuestionEmpty String Overkill Pin
Blake Miller16-Dec-05 8:16
Blake Miller16-Dec-05 8:16 
AnswerRe: Empty String Overkill Pin
grigsoft16-Dec-05 9:04
grigsoft16-Dec-05 9:04 
AnswerRe: Empty String Overkill Pin
Tim Smith16-Dec-05 11:44
Tim Smith16-Dec-05 11:44 
GeneralRe: Empty String Overkill Pin
Jörgen Sigvardsson16-Dec-05 12:27
Jörgen Sigvardsson16-Dec-05 12:27 
AnswerRe: Empty String Overkill Pin
David Crow16-Dec-05 15:00
David Crow16-Dec-05 15:00 
AnswerRe: Empty String Overkill Pin
VikramDelhi16-Dec-05 20:40
VikramDelhi16-Dec-05 20:40 
QuestionChange CStatic runtime? Pin
PatP0716-Dec-05 7:46
PatP0716-Dec-05 7:46 
AnswerRe: Change CStatic runtime? Pin
Nish Nishant16-Dec-05 7:47
sitebuilderNish Nishant16-Dec-05 7:47 
GeneralRe: Change CStatic runtime? Pin
PatP0716-Dec-05 8:54
PatP0716-Dec-05 8:54 
GeneralRe: Change CStatic runtime? Pin
Nish Nishant16-Dec-05 9:06
sitebuilderNish Nishant16-Dec-05 9:06 
GeneralRe: Change CStatic runtime? Pin
Nish Nishant16-Dec-05 9:08
sitebuilderNish Nishant16-Dec-05 9:08 

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.