How do I access a function in a namespace from the main MFC app file?
- From: Charlie <none@xxxxxxxx>
- Date: Thu, 21 Jul 2005 03:15:27 GMT
There is a high chance that I have overlooked something simple in my
quest to make this program work. Here is the sitrep....
I have a class that contains functions to interact with a USB hardware
interface kit. The class creates an object of the interface kit type
and has all of the functions to open & close the device, pull data
from it, and set data to it. The class itself is derived from an
abstract class with a bunch of virtual functions in it (included for
future upgrades). All of this is no problem.
Now what I am trying to do is create an MFC GUI to control it and
display data. I've seen some topics using Google Groups but none of
them helped too much.
I have a menu bar with two selections for 'Turn On' and 'Turn Off'.
Those are set to OnTurnOn() and OnTurnOff() in the main .cpp file. I
have included the #include for the header file of my class. The
problem, as you all have guessed, is that when I call the functions...
the compiler spits out errors.
I have tried to instantiate an object for my class in this .cpp file
but it doesnt like that at all. TheClass theClass = new TheClass();
I tried to do a forward declaration in the main header file like so...
In the .h: TheClass* theClass;
In the .cpp: theClass = new TheClass();
And again, error up a storm.
I have tried to access the functions (which are all in namespace
Project) as such....
Project::SomeFunction();
and also....
Project::TheClass::SomeFunction();
Nope and Nope. Even tried to declare everything as static just for
grins and the compiler puked on me.
I think you should have a pretty good idea of what I am failing to
accomplish. Any good tips on how to do this properly? (I do want to
use MFC for this so not using it isn't really a good option!) :)
Thanks in advance.
.
- Follow-Ups:
- Re: How do I access a function in a namespace from the main MFC app file?
- From: Scot T Brennecke
- Re: How do I access a function in a namespace from the main MFC app file?
- Prev by Date: Using the Exchange Backup API
- Next by Date: Re: CStdioFile.GetPosition
- Previous by thread: Using the Exchange Backup API
- Next by thread: Re: How do I access a function in a namespace from the main MFC app file?
- Index(es):