primary expression error when calling operation

This is a discussion on primary expression error when calling operation within the C++ Programming forums, part of the General Programming Boards category; Hi again Whenever I try and call the function of my food class I get the error expected primary-expression before ...

  1. #1
    Registered User
    Join Date
    Dec 2009
    Posts
    27

    primary expression error when calling operation

    Hi again

    Whenever I try and call the function of my food class I get the error

    expected primary-expression before ')' token

    heres the operation being called

    Code:
    food::draw_food(Canvas)
    ;

    i've checked for differences between the declaration, implementation and call and they're all the same

    Code:
    void draw_food(Canvas &canvas)
    Code:
    void food::draw_food(Canvas &canvas)
    any ideas?

    Thanks

    ES

    P.S this should be one of the last threads I start today, thank you all for your patience and help

  2. #2
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,794
    Canvas appears to be a type (class?) and not an instance of said type which is what would be needed when actually calling a function.
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

  3. #3
    Registered User
    Join Date
    Dec 2009
    Posts
    27
    your right, it should be 'canvas' rather than 'Canvas'. thanks

    the only problem is, it now can't find canvas :-S

    going to have to figure out how to pass canvas along the functions to reach draw_food

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling C in Visual Studio 2005
    By emanresu in forum C Programming
    Replies: 3
    Last Post: 11-16-2009, 03:25 AM
  2. Help with making a Math Expression DLL
    By MindWorX in forum C Programming
    Replies: 19
    Last Post: 07-19-2007, 11:37 PM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  4. recursion error
    By cchallenged in forum C Programming
    Replies: 2
    Last Post: 12-18-2006, 08:15 AM
  5. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 10:03 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21