i have a c2065 undeclared identifier error although i declared it

hend naged 1 Reputation point
2022-04-12T16:32:40.137+00:00

include "RegisterForm.h"

using namespace CppWinFormApp4; //name of project
.
.
.
.
.
private: System::Void button4_Click(System::Object^ sender, System::EventArgs^ e) {
RegisterForm ^ reg = gcnew RegisterForm;
reg->Show();

}
When I do that I get error c2065 saying i have an undeclared identifier

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,601 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Michael Taylor 50,426 Reputation points
    2022-04-12T19:01:11.017+00:00

    Perhaps it is complaining about Show and not reg? Go to definition on RegisterForm and make sure it has a Show method that accepts no arguments. Also make sure this is the only error in your code. If there are other errors then resolve them first.

    0 comments No comments