Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > Visual C++
|
Visual C++ Questions specific to Microsoft's Visual C++. For questions not specific to this Microsoft version, use the C++ Programming forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual C++ section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 20th, 2004, 07:24 AM
Registered User
 
Join Date: Jan 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Trouble with pointer to and from CMainFrame

Hi,

I'm posting this as I'm pretty desperate, I don't know how to work around this.

I'm writing a code (Visual C++ 6) in which CMainFrame class has a member of a generic (non-MFC) class CSceneManager. In turn, CSceneManager has a pointer to CMainFrame. The idea is to be able to exchange calls between both classes, as CSceneManager will be using CMainFrame as a 'user interface class' and I want CMainFrame to call CSceneManager member functions and CSceneManager to call CMainFrame functions. I don't want to use Windows Messages, as CSceneManager should be kept as much platform-independent as possible.

Thing is... I don't get it. I'm certainly missing something, probably very obvious, but it doesn't work.

I declare the CSceneManager class object m_SceneManager in CMainFrame this way:

CSceneManager m_SceneManager;

Then declare a pointer to CMainFrame in CSceneManager class:

CMainFrame *pUserInterface;

Whenever I compile this, it starts to moan it doesn't know CMainFrame or CSceneManager, even though MainFrm.h has a #include "SceneManager.h" and SceneManager.h has a #include "MainFrm.h"

I have good notions on what is a pointer, what is a reference and such matters, but I lack the experience on C++ to be sure what the hell I'm declaring and why, as I've gone into berserk mode and tried adding or deleting '*'s anywhere (which, of course, only multiplies compilation errors).

If anyone out there can give me a clue on how to solve this, it would be fantastic... I'm going nut on this and feel that it's something I've not paid attention to.

Thank you in advance.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Constant pointer and pointer to a constant [email protected] C++ Programming 2 June 5th, 2007 01:39 AM
Pointer fReqZz C++ Programming 5 June 5th, 2007 01:09 AM
Pointer reference perstam C++ Programming 5 April 29th, 2006 08:51 AM
NULL Pointer kumar_raj13 C++ Programming 0 July 15th, 2005 01:10 AM
pointer-to-function in C++ jacob C++ Programming 2 October 23rd, 2004 05:20 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.