none
error 'Create': identifier not found

    Question

  • Hi guys,

    I need your help as I have a problem when I tried to debugging of the application.

    Here it's the code:

    [CODE]
    // Form1.cpp

    using namespace System::Data;
    using namespace System::Drawing;
    using namespace System::Net;
    using namespace System::IO;
    using namespace System::Text;
    using namespace System::Web;
    using namespace System::Runtime::InteropServices;
    using namespace System::Text::RegularExpressions;
    using namespace System::Configuration;
    using namespace System::Collections::Generic;

    #include "StdAfx.h"
    #include "Form1.h"
    #include "Form2.h"

    using namespace MyApplication;  // Of course the namespace name would be Test in your project

    System::Void Form1::ListView1_DoubleClick(System::Object^  sender, System::EventArgs^  e)
    {            
        Form2 ^form2 = dynamic_cast<Form2 ^>(Owner);
        //Address of URL
        String ^URL = "http://www.mysite.com/myscript.php?user=" + form2->ComboBox1->Text + "&pass=" + form2->TextBox1->Text;
        HttpWebRequest ^request = safe_cast<HttpWebRequest^>(WebRequest::Create(URL));
        HttpWebResponse ^response = safe_cast<HttpWebResponse^>(request->GetResponse());
        StreamReader ^reader = gcnew StreamReader(response->GetResponseStream());
        String ^str = reader->ReadToEnd();


    The error I have got ('Create': identifier not found) is a member of a property called webRequest. The error are jumping on this line:


    HttpWebRequest ^request = safe_cast<HttpWebRequest^>(WebRequest::Create(URL));
    



    I don't know what to do.

    Any idea?
    Saturday, April 23, 2011 2:07 PM

Answers

All replies

  • Can you copy/paste the exact error message?
    http://blog.voidnish.com
    Saturday, April 23, 2011 2:25 PM
  • There are two errors as I have got, so here it is:

    Error: error C2039: 'Create' : is not a member of 'System::Net::WebRequest'

    Error: error C3861: 'Create': identifier not found

    Saturday, April 23, 2011 2:28 PM
  • Might be a name-clash. Have you #include-d any native header files in this cpp? One of those may have a Create function.
    http://blog.voidnish.com
    • Marked as answer by Mark103 Sunday, April 24, 2011 5:51 PM
    Saturday, April 23, 2011 2:38 PM
  • I am not sure what do you mean by "have you #include-d any native header files in this cpp?

    As far I have included the #include in the native header file in this cpp which you can see it right here:

     

    // Form1.cpp
    
    using namespace System::Data;
    using namespace System::Drawing;
    using namespace System::Net;
    using namespace System::IO;
    using namespace System::Text;
    using namespace System::Web;
    using namespace System::Runtime::InteropServices;
    using namespace System::Text::RegularExpressions;
    using namespace System::Configuration;
    using namespace System::Collections::Generic;
    
    #include "StdAfx.h"
    #include "Form1.h"
    #include "Form2.h"
    

     

    If you don't meant that then i need you explains a little bit more clear please.

    Thanks,
    Mark

    Saturday, April 23, 2011 3:00 PM
  • Can you paste the contents of stdafx.h (so I know what you are including there) ?
    http://blog.voidnish.com
    Saturday, April 23, 2011 3:27 PM