Click here to Skip to main content
15,921,905 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: problem in my progress bar (attached in a Dialog) Pin
Cedric Moonen16-Aug-06 1:45
Cedric Moonen16-Aug-06 1:45 
Questiongetch() problem. Pin
Kiran Pinjala16-Aug-06 1:10
Kiran Pinjala16-Aug-06 1:10 
AnswerRe: getch() problem. Pin
Rage16-Aug-06 1:28
professionalRage16-Aug-06 1:28 
AnswerRe: getch() problem. Pin
sunit516-Aug-06 1:46
sunit516-Aug-06 1:46 
AnswerRe: getch() problem. Pin
David Crow16-Aug-06 2:40
David Crow16-Aug-06 2:40 
Questionwav file format [modified] Pin
69 Bay16-Aug-06 0:35
69 Bay16-Aug-06 0:35 
Questionpragma once Pin
Sarvan AL16-Aug-06 0:14
Sarvan AL16-Aug-06 0:14 
AnswerRe: pragma once Pin
Rage16-Aug-06 1:40
professionalRage16-Aug-06 1:40 
Sarvan AL wrote:
Hope this is a way to avoid including the file (.h) more than once in the application


Yes, it is. However, the #ifdef/#define##endif should normally be located inside File1.h, and not where it is called.

In File1.h:

#ifndef _FILE1_H
#define _FILE1_H

.. here the declarations

#endif


In the .cpp

#include "File1.h"

Otherwise, you need to reproduce the ifndef/endif block for each include of the File1.h, which is no good practice (unless you have some hardware limitation, like the h file is located on some network that is lengthy to be accessed and that the simple fact of going inside the include lasts 5 seconds or more).

#pragma are directive to the precompiler, e.g. the software that runs one time through the code before the compiler. It replaces all occurences of #defines with their real value, copies the content of includes inside the cpp file, etc..
The precompiler can be given some directives using #pragma, such as #pragma disable(warning:1020) which disables warning 1020. Meaning and sometimes existence of pragmas depends on the compiler.

#pragma once is a directive that (for visual c++, but also other compiler) says that the file in which it is located must only be included once. It is equivalent to the code block I've provided you with.


~RaGE();

I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus

GeneralRe: pragma once Pin
Sarvan AL16-Aug-06 1:48
Sarvan AL16-Aug-06 1:48 
GeneralRe: pragma once [modified] Pin
sunit516-Aug-06 2:03
sunit516-Aug-06 2:03 
QuestionCannot edit and continue in VC++ 2005. Pin
tonyvsuk15-Aug-06 23:46
tonyvsuk15-Aug-06 23:46 
QuestionVC++ Linking error to do with += Operator Pin
ajisthekingofpop15-Aug-06 23:40
ajisthekingofpop15-Aug-06 23:40 
AnswerRe: VC++ Linking error to do with += Operator Pin
Rage16-Aug-06 1:42
professionalRage16-Aug-06 1:42 
QuestionRe: VC++ Linking error to do with += Operator Pin
David Crow16-Aug-06 2:47
David Crow16-Aug-06 2:47 
AnswerRe: VC++ Linking error to do with += Operator Pin
Zac Howland16-Aug-06 4:17
Zac Howland16-Aug-06 4:17 
GeneralRe: VC++ Linking error to do with += Operator Pin
Rage16-Aug-06 5:29
professionalRage16-Aug-06 5:29 
QuestionvbAccelerator Explorer Bar Control Pin
Hesham Desouky15-Aug-06 23:22
Hesham Desouky15-Aug-06 23:22 
QuestionDRM question Pin
shadow0115-Aug-06 23:03
shadow0115-Aug-06 23:03 
AnswerRe: DRM question Pin
Mircea Puiu16-Aug-06 23:13
Mircea Puiu16-Aug-06 23:13 
QuestionUSING FormatMessage Pin
fx920015-Aug-06 22:57
fx920015-Aug-06 22:57 
AnswerRe: USING FormatMessage Pin
Rage16-Aug-06 1:31
professionalRage16-Aug-06 1:31 
QuestionCovert char array to unsined char array Pin
Tuscon15-Aug-06 22:54
Tuscon15-Aug-06 22:54 
AnswerRe: Covert char array to unsined char array Pin
Rage15-Aug-06 23:03
professionalRage15-Aug-06 23:03 
AnswerRe: Covert char array to unsined char array Pin
Eytukan16-Aug-06 0:57
Eytukan16-Aug-06 0:57 
AnswerRe: Covert char array to unsined char array Pin
Zac Howland16-Aug-06 4:22
Zac Howland16-Aug-06 4:22 

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.