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

C / C++ / MFC

 
Question#pragma once, #ifndef problem Pin
werfel16-Dec-05 10:06
werfel16-Dec-05 10:06 
AnswerRe: #pragma once, #ifndef problem Pin
Maximilien16-Dec-05 10:12
Maximilien16-Dec-05 10:12 
GeneralRe: #pragma once, #ifndef problem Pin
werfel16-Dec-05 10:17
werfel16-Dec-05 10:17 
GeneralRe: #pragma once, #ifndef problem Pin
Maximilien16-Dec-05 10:22
Maximilien16-Dec-05 10:22 
GeneralRe: #pragma once, #ifndef problem Pin
werfel16-Dec-05 10:26
werfel16-Dec-05 10:26 
GeneralRe: #pragma once, #ifndef problem Pin
Michael Dunn16-Dec-05 10:59
sitebuilderMichael Dunn16-Dec-05 10:59 
GeneralRe: #pragma once, #ifndef problem Pin
werfel16-Dec-05 11:15
werfel16-Dec-05 11:15 
GeneralRe: #pragma once, #ifndef problem Pin
werfel16-Dec-05 11:34
werfel16-Dec-05 11:34 
i feel like it might help if i gave some more background info.

i've built a lot of programs in the past that required a Dialog box where you could plot a time-series, or a series of XY's, etc and zoom in and out, etc...

in the past, i would create a new class within each application, derived from CDialog, and add all the functions to it

after doing this a dozen times, i've gotten tired of all the copying and pasting, and tweaking to whatever the new app required. so i wanted to create an independent class that i could call from any app, without having to re-build each time. i created a file, GraphDialog.h, which looks like this:

class GraphDialog : public CDialog
{
public:
// member variables & functions
};

everything worked great until i wanted to do some callback functions (e.g. WM_LBUTTONDOWN). i created them using ClassView, which created a companion .cpp

the prob, i think, is that the .cpp file #includes the .h, as does MainFrm.h, furthermore, the app.cpp #includes MainFrm.h, so GraphDialog.h ends up getting called 3 times, and i see no way around this

one of the member functions wants to use a commonly used function that i placed in another external .h

when i try to #include that .h from GraphDialog.h that function shows up as multiply defined

thanks!!
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 
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 

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.