Re: Function in header file - newbie VC++/CLI
- From: "Jacek" <majly@xxxxxxxxx>
- Date: Tue, 3 Jul 2007 22:37:43 +0200
Uzytkownik "Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp> napisal w
wiadomosci news:9t-dncNZl81EPRfbnZ2dnUVZ_ualnZ2d@xxxxxxxxxxxxxx
When you move the function into a cpp file you have to put the class nameIt dosen't resolve problem
in front of it:
void Form1::Status (String ^message)
{
...
}
Otherwise the compiler thinks it is a global function. I.e., not a member
of any class.
--
Scott McPhillips [MVP VC++]
Error 1 error C2653: 'Form1' : is not a class or namespace name
c:...\projects\header\header\function.h 5
For example if i make header file like this:
#pragma once
void Status (System::String ^message)
{
message = "global function";
} ;
works good. So problem isn't with that.
Problem occurs when I add to this function any command related with controls
on Form.
For example:
/// function.h
#pragma once
void Status (System::String ^message)
{
message = "global function";
this->MessageBox::Show (message);
} ;
errors:
Error 1 error C2673: 'Status' : global functions do not have 'this' pointers
c:\...\header\function.h 8
Error 2 error C2653: 'MessageBox' : is not a class or namespace name
c:\...\header\function.h 8
Error 3 error C2227: left of '->Show' must point to
class/struct/union/generic type c:\..\header\function.h 8
when i remove this-> errors are:
Error 1 error C2653: 'MessageBox' : is not a class or namespace name
c:\..\header\function.h 8
Error 2 error C3861: 'Show': identifier not found c:\..\header\function.h 8
Problem is with pointer this->. I don't know what it can replace.
.
- Follow-Ups:
- Re: Function in header file - newbie VC++/CLI
- From: Jacek
- Re: Function in header file - newbie VC++/CLI
- References:
- Function in header file - newbie VC++/CLI
- From: Jacek
- Re: Function in header file - newbie VC++/CLI
- From: Tom Serface
- Re: Function in header file - newbie VC++/CLI
- From: Duane Hebert
- Re: Function in header file - newbie VC++/CLI
- From: Jacek
- Re: Function in header file - newbie VC++/CLI
- From: Scott McPhillips [MVP]
- Function in header file - newbie VC++/CLI
- Prev by Date: Re: how do I export symbols for MFC executable to create a .NET dll reference?
- Next by Date: Re: Function in header file - newbie VC++/CLI
- Previous by thread: Re: Function in header file - newbie VC++/CLI
- Next by thread: Re: Function in header file - newbie VC++/CLI
- Index(es):
Relevant Pages
|