#Struggling with errors.

9 messages · Page 1 of 1 (latest)

fiery hearth
#

I recognize that this program still needs a lot of work before it's complete, but I've dead-walled on progress because of an error code and the due date fast approaches.

/usr/bin/ld: /tmp/cc3g0oFN.o: in function main': main.cpp:(.text+0x53): undefined reference to getData(std::__cxx11::basic_string, std::allocator >, double)'
/usr/bin/ld: main.cpp:(.text+0x7c): undefined reference to sumVotes(double)' /usr/bin/ld: main.cpp:(.text+0x99): undefined reference to computePercentages(double, double)'
collect2: error: ld returned 1 exit status

I assume that I've done a big stupid and formatted my functions like an idiot, but I've been staring at them for three hours and could really use a nudge or even a violent shove in the right direction.
Thanks and sorry in advance for wading through my garbage code.

drifting berryBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

tawdry marten
#

The errors you received are from the linker. The error in English is that you're calling sumVote(double votes[]) but you've forward-declared sumVote(double). Notice the missing square brackets.

#

Go through and carefully check that each of your function forward declarations match the function signature of the definitions.

#

Any time you see an error from the linker saying 'undefined reference' it means that you've most likely mixed up function parameter types or have just omitted the function implementation all together.

#

Make sense?

fiery hearth
#

I believe so. I'll run through it now. Thank you!

drifting berryBOT
#

@fiery hearth Has your question been resolved? If so, run !solved :)

fiery hearth
#

!solved