Uzytkownik "Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp> napisal w
wiadomosci news:9t-dncNZl81EPRfbnZ2dnUVZ_ualnZ2d@comcast.com...
When you move the function into a cpp file you have to put the class name
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++]
It dosen't resolve problem
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.