Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I suddenly got a compiler error message says the following: /usr/bin/ld: /tmp/ccYM4KZU.o: in function `main': main.cpp:(.text+0x23): undefined reference to `Election::Election()' collect2: error: ld returned 1

I suddenly got a compiler error message says the following:

/usr/bin/ld: /tmp/ccYM4KZU.o: in function `main': main.cpp:(.text+0x23): undefined reference to `Election::Election()' collect2: error: ld returned 1 exit status make: *** [Makefile:10: main] Error 1

This happens when I try to declare an Election object. I did not have this problem before. Can't figure out why because I believe my Election object should not need a user-defined constructor. The object only has a vector of candidates as the private data member

image text in transcribedimage text in transcribedimage text in transcribed

class Election public: Election(); void Registration(int,string); candidate getCandidate(int); void campaign(ElectoralMap&,int,int); private: vector candidates; }; #endif // ! ELECTION_HPP static int candidateID @; void Election::Registration(int partyID, string name_)] candidateID H; candidate newCandidate; newCandidate.id = candidateID; newCandidate.affiliations - partyID; newCandidate.name = name_ ;//mitr1123@colorado.edu candidates.push_back(newCandidate); candidate Election::getCandidate(int candidateID) { candidate c; c.id = -1; for (int i = 0; i void Election:: campaign(ElectoralMap& theMap, int districtId, int candidateID) { --- } * ma Election theElection; theElection. Registration (2, "Zhang"); theElection. Registration (2, "Killer"); candidate p the Election.getCandidate(1); std::cout

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

More Books

Students also viewed these Databases questions