error C2065: 'NULL' : undeclared identifier

Hi,I have problem to determine whether a point is a NULL point in vc++ 2005,

Here is my source code:

private: System::Void treeView1_MouseClick(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e) {
Point mouseDownLocation = Point(e->X,e->Y);
TreeNode ^newNode = treeView1->GetNodeAt(mouseDownLocation);
if(newNode == NULL )

......

}

There is error whith these code,the error message is:error C2065: 'NULL' : undeclared identifier.

Am I missing the head file If it is ,which file

Thanks for your help.



Answer this question

error C2065: 'NULL' : undeclared identifier

  • - Pascal -

    #include <string>


  • PhilJComputerGuy

    Thanks!
  • Melapower3000

    Don't use NULL in managed code. Use nullptr.

    if(newNode == nullptr)
    {
    . . .
    }

    liusongyun wrote:

    Hi,I have problem to determine whether a point is a NULL point in vc++ 2005,

    Here is my source code:

    private: System::Void treeView1_MouseClick(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e) {
    Point mouseDownLocation = Point(e->X,e->Y);
    TreeNode ^newNode = treeView1->GetNodeAt(mouseDownLocation);
    if(newNode == NULL )

    ......

    }

    There is error whith these code,the error message is:error C2065: 'NULL' : undeclared identifier.

    Am I missing the head file If it is ,which file

    Thanks for your help.



  • error C2065: 'NULL' : undeclared identifier