Click here to Skip to main content
15,897,519 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: To get the excel9.cpp & excel9.h Pin
David Viggiano17-Apr-02 8:20
David Viggiano17-Apr-02 8:20 
GeneralRe: To get the excel9.cpp & excel9.h Pin
18-Apr-02 0:01
suss18-Apr-02 0:01 
Generalputref Question Pin
Brian V Shifrin17-Apr-02 6:30
Brian V Shifrin17-Apr-02 6:30 
GeneralRe: putref Question Pin
Brian V Shifrin17-Apr-02 8:33
Brian V Shifrin17-Apr-02 8:33 
QuestionHow to get the stream associated with a SoapSerializer? Pin
Gian Luca17-Apr-02 5:28
Gian Luca17-Apr-02 5:28 
GeneralWin32 question Pin
17-Apr-02 5:26
suss17-Apr-02 5:26 
GeneralRe: Win32 question Pin
Tim Smith17-Apr-02 5:31
Tim Smith17-Apr-02 5:31 
Generalincluding .cpp file Pin
Rajveer17-Apr-02 5:24
Rajveer17-Apr-02 5:24 
I have global variables
float xtrans, ytrans; defined in my file TestGLView.cpp

and I have this function for handling keyboard events in my file ChildFrm.cpp
void CChildFrame::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default

CMDIChildWnd::OnKeyDown(nChar, nRepCnt, nFlags);

char keypressed = char(nChar);

if(keypressed == 'I')
ytrans += 0.2;

if(keypressed == 'K')
ytrans -= 0.2;
}

this function uses the global variables from TestGLView.cpp
so I need to #include "TestGLView.cpp" in the file ChildFrm.cpp
but when I do that, I get this error:
C:\WINDOWS\Desktop\QE2 heart program\ChildFrm.cpp(14) : error C2370: 'THIS_FILE' : redefinition; different storage class
c:\windows\desktop\qe2 heart program\testglview.cpp(22) : see declaration of 'THIS_FILE'

so I comment out this line from ChildFrm.cpp since its present at the top of both files:
static char THIS_FILE[] = __FILE__;

but then I get tons of other errors, here are some:
TestGLView.obj : error LNK2005: "public: static class CObject * __stdcall CTestGLView::CreateObject(void)" (?CreateObject@CTestGLView@@SGPAVCObject@@XZ) already defined in ChildFrm.obj
TestGLView.obj : error LNK2005: "protected: static struct CRuntimeClass * __stdcall CTestGLView::_GetBaseClass(void)" (?_GetBaseClass@CTestGLView@@KGPAUCRuntimeClass@@XZ) already defined in ChildFrm.obj
TestGLView.obj : error LNK2005: "public: virtual struct CRuntimeClass * __thiscall CTestGLView::GetRuntimeClass(void)const " (?GetRuntimeClass@CTestGLView@@UBEPAUCRuntimeClass@@XZ) already defined in ChildFrm.obj


So how can I alter the global variables from another file without having to deal with all this? There must be an easier way???
GeneralRe: including .cpp file Pin
Phil Speller17-Apr-02 5:39
Phil Speller17-Apr-02 5:39 
GeneralRe: including .cpp file Pin
Thomas Freudenberg17-Apr-02 5:40
Thomas Freudenberg17-Apr-02 5:40 
GeneralPressing Arrow Key Pin
Rajveer17-Apr-02 5:03
Rajveer17-Apr-02 5:03 
GeneralRe: Pressing Arrow Key Pin
Nish Nishant17-Apr-02 5:17
sitebuilderNish Nishant17-Apr-02 5:17 
GeneralRe: Pressing Arrow Key Pin
Paul M Watt17-Apr-02 5:25
mentorPaul M Watt17-Apr-02 5:25 
GeneralRe: Pressing Arrow Key Pin
Roger Allen17-Apr-02 5:53
Roger Allen17-Apr-02 5:53 
GeneralVC++ DAO Project. Access97 --> Access2000 Pin
Pere LLibre17-Apr-02 3:56
Pere LLibre17-Apr-02 3:56 
GeneralRe: VC++ DAO Project. Access97 --> Access2000 Pin
Nish Nishant17-Apr-02 4:05
sitebuilderNish Nishant17-Apr-02 4:05 
GeneralRe: VC++ DAO Project. Access97 --> Access2000 Pin
Pere LLibre18-Apr-02 3:05
Pere LLibre18-Apr-02 3:05 
GeneralRe: VC++ DAO Project. Access97 --> Access2000 Pin
Carlos Antollini18-Apr-02 4:27
Carlos Antollini18-Apr-02 4:27 
GeneralRe: VC++ DAO Project. Access97 --> Access2000 Pin
Carlos Antollini18-Apr-02 4:28
Carlos Antollini18-Apr-02 4:28 
GeneralRe: VC++ DAO Project. Access97 --> Access2000 Pin
Carlos Antollini18-Apr-02 4:35
Carlos Antollini18-Apr-02 4:35 
GeneralRe: VC++ DAO Project. Access97 --> Access2000 Pin
Pere LLibre18-Apr-02 4:56
Pere LLibre18-Apr-02 4:56 
GeneralRe: VC++ DAO Project. Access97 --> Access2000 Pin
Carlos Antollini18-Apr-02 5:02
Carlos Antollini18-Apr-02 5:02 
GeneralRe: VC++ DAO Project. Access97 --> Access2000 Pin
Carlos Antollini18-Apr-02 4:35
Carlos Antollini18-Apr-02 4:35 
GeneralGet Window Handles Pin
moobob17-Apr-02 3:49
moobob17-Apr-02 3:49 
GeneralRe: Get Window Handles Pin
Ravi Bhavnani17-Apr-02 3:54
professionalRavi Bhavnani17-Apr-02 3:54 

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.