dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Unfamiliar compiler message

  1. #1
    Join Date
    Oct 2009
    Posts
    56

    Unfamiliar compiler message

    I'm trying to add some ADTs to corresponding vectors and test my toString() function. When I build the project, I get the compiler message --
    Code:
    1>c:\users\sterling\documents\visual studio 2008\projects\building\building\building.cpp(54) : error C2664: 'void Bathroom::addShower(Shower)' : cannot convert parameter 1 from 'Shower (__cdecl *)(void)' to 'Shower'
    1>        No constructor could take the source type, or constructor overload resolution was ambiguous
    That is just the first message for room.addShower(one);
    I get a message for each attempt to add.

    My main code is just
    Code:
    	Bathroom room;
    	Shower one();
    	Shower two();
    	Stall three();
    	Stall four();
    	Stall five();
    	Mirror six();
    	Sink seven();
    	room.addShower(one);
    	room.addShower(two);
    	room.addStall(three);
    	room.addStall(four);
    	room.addStall(five);
    	room.addMirror(six);
    	room.addSink(seven);
    	cout<<room.toString();
    I'm pretty lost when I read the compiler message, what is it trying to tell me?

  2. #2
    Join Date
    Oct 2009
    Posts
    56

    Re: Unfamiliar compiler message

    Nevermind, the () after Shower one, Shower two, etc was the problem.

  3. #3
    Join Date
    Jun 2002
    Location
    Letchworth, UK
    Posts
    1,019

    Re: Unfamiliar compiler message

    Just to reiterate what happened - the () makes it a forward declaration: not a variable declaration.
    Succinct is verbose for terse

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)