Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / June 2007

Tip: Looking for answers? Try searching our database.

Compile error in vs2005 but not in vs2003

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
TonyJ - 27 Jun 2007 14:17 GMT
Hello!

I get compile when using VS2005 but not in VS2003.

The compile error is the following
"Error 1 error C3867: 'MeltPracCommon::ReasonDialog::tbReason_TextChanged':
function call missing argument list; use
'&MeltPracCommon::ReasonDialog::tbReason_TextChanged' to create a pointer to
member c:\pk\development\products\utcas\4.0\src\commoncontrol\ReasonDialog.h
110"

When I click on the error it set the curson on this row."
this->tbReason->TextChanged += new System::EventHandler(this,
tbReason_TextChanged);"

The function tbReason_TextChanged has the following definition.
private: System::Void tbReason_TextChanged(System::Object * sender,
System::EventArgs * e)
{
   String* reason = tbReason->Text;
   if ( reason->get_Length() == 0 )
       this->btnOk->Enabled = false;
  else
      this->btnOk->Enabled = true;
}

How do I fix the compile error?

//Tony
SvenC - 27 Jun 2007 14:24 GMT
Hi

> I get compile when using VS2005 but not in VS2003.
>
[quoted text clipped - 10 lines]
> this->tbReason->TextChanged += new System::EventHandler(this,
> tbReason_TextChanged);"

I guess the compiler tells you to do this:

this->tbReason->TextChanged += new System::EventHandler(this,
&MeltPracCommon::ReasonDialog::tbReason_TextChanged);

VC2003 was not standard compliant in this area and accepted your old syntax.

--
SvenC
Ben Voigt [C++ MVP] - 27 Jun 2007 20:17 GMT
> Hi
>
[quoted text clipped - 20 lines]
> VC2003 was not standard compliant in this area and accepted your old
> syntax.

He's compiling with /clr:oldSyntax it appears, from the function definition
given.  And there was no standard in the VC2003 days.

> --
> SvenC
David Wilkinson - 27 Jun 2007 21:14 GMT
>> Hi
>>
[quoted text clipped - 22 lines]
> He's compiling with /clr:oldSyntax it appears, from the function definition
> given.  And there was no standard in the VC2003 days.

Ben:

I think Sven was talking about the general C++ syntax for pointer to
member function, which is not specific to .NET. VC versions prior to VC8
would allow omission of the class name, as well as the required &.

I must say I have never understood why the pointer to member function
syntax gas to be so picky (why the & is not optional, and why the class
name cannot be determined by the usual scoping rules). It seems at odds
with other things in the C++ language.

Signature

David Wilkinson
Visual C++ MVP

SvenC - 28 Jun 2007 07:57 GMT
>>>> The compile error is the following
>>>> "Error 1 error C3867:
[quoted text clipped - 24 lines]
> member function, which is not specific to .NET. VC versions prior to VC8
> would allow omission of the class name, as well as the required &.

Yes, correct assumption.

--
SvenC
Ben Voigt [C++ MVP] - 27 Jun 2007 14:24 GMT
> Hello!
>
[quoted text clipped - 26 lines]
>
> How do I fix the compile error?

Any reason you didn't just do what it says?  You are using a
pointer-to-member here, and the error message gives you the corrected
syntax.

> //Tony

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.