Click here to Skip to main content
15,909,051 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: error C2011: 'CMemDC' : 'class' type redefinition Pin
Cool_Dev31-Jan-11 21:38
Cool_Dev31-Jan-11 21:38 
GeneralRe: error C2011: 'CMemDC' : 'class' type redefinition Pin
VCProgrammer31-Jan-11 21:41
VCProgrammer31-Jan-11 21:41 
GeneralRe: error C2011: 'CMemDC' : 'class' type redefinition Pin
PJ Arends1-Feb-11 18:14
professionalPJ Arends1-Feb-11 18:14 
GeneralRe: error C2011: 'CMemDC' : 'class' type redefinition Pin
Malli_S1-Feb-11 20:40
Malli_S1-Feb-11 20:40 
QuestionPreprocessor Directive Pin
pix_programmer31-Jan-11 17:34
pix_programmer31-Jan-11 17:34 
AnswerRe: Preprocessor Directive PinPopular
Andrew Brock31-Jan-11 17:48
Andrew Brock31-Jan-11 17:48 
GeneralRe: Preprocessor Directive Pin
Niklas L31-Jan-11 21:15
Niklas L31-Jan-11 21:15 
GeneralRe: Preprocessor Directive [modified] Pin
Stefan_Lang31-Jan-11 23:25
Stefan_Lang31-Jan-11 23:25 
[edit]Please ignore this, see responses below[/edit]

Using #pragma once still forces the compiler to at least reopen the header file. If you want to prevent that as well you have to place the guards outside the header file, around every inclusion, such as this:

// File A.h
#define MY_GUARD_A_H

class A {
  // ...
};
// end of file A.h


// File A.cpp
#ifndef MY_GUARD_A_H
#include "A.h"
#endif

// ...

//end of file A.cpp


I've done it like that in a project once, some 20+ years ago, but it was a hell to maintain. It did help a lot though, as it was really a huge project, and computers (and specifically file system calls) weren't all that fast at the time.

modified on Tuesday, February 1, 2011 5:55 AM

GeneralRe: Preprocessor Directive Pin
Andrew Brock31-Jan-11 23:46
Andrew Brock31-Jan-11 23:46 
GeneralRe: Preprocessor Directive Pin
Stefan_Lang31-Jan-11 23:55
Stefan_Lang31-Jan-11 23:55 
GeneralRe: Preprocessor Directive Pin
Andrew Brock31-Jan-11 23:57
Andrew Brock31-Jan-11 23:57 
GeneralRe: Preprocessor Directive Pin
Niklas L1-Feb-11 1:50
Niklas L1-Feb-11 1:50 
GeneralRe: Preprocessor Directive Pin
Niklas L1-Feb-11 1:41
Niklas L1-Feb-11 1:41 
GeneralRe: Preprocessor Directive Pin
Stefan_Lang1-Feb-11 0:11
Stefan_Lang1-Feb-11 0:11 
AnswerRe: Preprocessor Directive Pin
Malli_S31-Jan-11 21:10
Malli_S31-Jan-11 21:10 
QuestionMFC - Printing - Changing page orientation from a custom pagesetup dialog [SOLVED] Pin
Un Suthee31-Jan-11 15:11
Un Suthee31-Jan-11 15:11 
AnswerRe: MFC - Printing - Changing page orientation from a custom pagesetup dialog Pin
Roger Allen2-Feb-11 5:46
Roger Allen2-Feb-11 5:46 
GeneralRe: MFC - Printing - Changing page orientation from a custom pagesetup dialog Pin
Un Suthee3-Feb-11 16:30
Un Suthee3-Feb-11 16:30 
Question2D dynamic wchar array Pin
csrss31-Jan-11 13:30
csrss31-Jan-11 13:30 
AnswerRe: 2D dynamic wchar array Pin
Andrew Brock31-Jan-11 16:41
Andrew Brock31-Jan-11 16:41 
GeneralRe: 2D dynamic wchar array Pin
csrss31-Jan-11 22:35
csrss31-Jan-11 22:35 
AnswerRe: 2D dynamic wchar array [DONE] Pin
csrss1-Feb-11 2:25
csrss1-Feb-11 2:25 
AnswerRe: 2D dynamic wchar array [modified] Pin
Emilio Garavaglia31-Jan-11 20:50
Emilio Garavaglia31-Jan-11 20:50 
GeneralRe: 2D dynamic wchar array Pin
csrss31-Jan-11 22:45
csrss31-Jan-11 22:45 
QuestionString array comparison Pin
jharn31-Jan-11 4:48
jharn31-Jan-11 4:48 

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.