Strange C++ error ...

This is a discussion on Strange C++ error ... within the C++ Programming forums, part of the General Programming Boards category; OK, here's the error I'm getting when using G++: Code: g++ -c -O -w chart.cpp chart.cpp: In method `void Chart::add(class ...

  1. #1
    MadGooseXP
    Guest

    Angry Strange C++ error ...

    OK, here's the error I'm getting when using G++:

    Code:
    g++ -c -O -w chart.cpp
    chart.cpp: In method `void Chart::add(class Edge, class ToDo &, const class LexList &)':
    chart.cpp:26: no matching function for call to `ToDo::add (int, Chart &)'
    chart.h:32: candidates are: ToDo::add(const Edge &, const Chart &)
    chart.cpp:37: no matching function for call to `ToDo::add (int, Chart &)'
    chart.h:32: candidates are: ToDo::add(const Edge &, const Chart &)
    make: *** [chart.o] Error 1
    What is making me extremely mad is the error I get on Line 26. I am calling ToDo::add with an Edge and a Chart, as the suggestion on the following line states. Specifically, here's the function call:
    Code:
    toDoList.add(meld(tempEdge, newEdge), *this);
    where meld(Edge, Edge) returns an Edge. How the hell does the compiler get an int out of this??! What can I do to correct this error?

  2. #2
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,139
    Can you post the meld functions prototype ?
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  3. #3
    Unregistered
    Guest
    like nvoigt said about the proto...as for the 2nd param, pass as...

    (const Chart) this

    ...should help. As far as I can tell, your meld() would have to return an int though to get that error. Maybe even try passing the return like this...


    (const Edge) meld(arg1, arg2)

    doesn't seem like it would call it an int if it weren't an int though ;x

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Testing some code, lots of errors...
    By Sparrowhawk in forum C Programming
    Replies: 48
    Last Post: 12-15-2008, 04:09 AM
  2. Connecting to a mysql server and querying problem
    By Diod in forum C++ Programming
    Replies: 8
    Last Post: 02-13-2006, 10:33 AM
  3. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 02:53 AM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 07:39 AM
  5. ras.h errors
    By Trent_Easton in forum Windows Programming
    Replies: 8
    Last Post: 07-15-2005, 11:52 PM

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