473,406 Members | 2,633 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Can't Find Unresolved External Symbol LNK2019

My compiler keeps saying LNK2019, and my teacher says to look for spelling error. He says that most likely what is happening is that a spelling error is messing my program up. I searched, and I did not find a spelling error though...

This is what my error message looks like
error LNK2019: unresolved external symbol "public: __thiscall weatherStationSystem::weatherStationSystem(void)" (??0weatherStationSystem@@QAE@XZ) referenced in function "public: __thiscall weatherSystemUI::weatherSystemUI(void)" (??0weatherSystemUI@@QAE@XZ)
1>C:\Users\yuhwachiang\Documents\Visual Studio 2008\Projects\Lab Six\Debug\Lab Six.exe : fatal error LNK1120: 1 unresolved externals

And my code is below. Thank you so much if you can figure this out. This lab is due by 11PM today, so I would really like to get it done.



Expand|Select|Wrap|Line Numbers
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. #include <iomanip>
  5. #include <fstream>
  6. using namespace std;
  7.  
  8. class pollenCount  {
  9.     protected:
  10.           double dailyHigh;
  11.           double dailyLow;
  12.  
  13.     public:
  14.           pollenCount() {dailyHigh = dailyLow = 0; }
  15.  
  16.           void setHighCount(double highPollen)  { dailyHigh = highPollen; }
  17.           void setLowCount(double lowPollen)   { dailyLow = lowPollen; }
  18.  
  19.           double getHighCount()  { return dailyHigh; }
  20.           double getLowCount()   { return dailyLow; }
  21.           double getMeanCount()  { return (dailyHigh + dailyLow)/2; }
  22.     };
  23.  
  24. class weatherStation : public pollenCount {
  25.         string stationDesignation;
  26.         string stationContact;
  27.         double stationTemperature;
  28.  
  29.     public:
  30.         weatherStation();
  31.         weatherStation(string, string, double);
  32.  
  33.         void setDesignation(string ID) {stationDesignation = ID;}
  34.         void setContact(string Contact) {stationContact = Contact;}
  35.         void setTemperature(double temperature) {stationTemperature = temperature;}
  36.  
  37.         string getDesignation() {return stationDesignation;}
  38.         string getContact() {return stationContact;}
  39.         double getTemperature() {return stationTemperature;}
  40.     };
  41.  
  42. weatherStation::weatherStation()
  43.     {
  44.         stationDesignation = "";
  45.         stationContact = "";
  46.         stationTemperature = 0.0;
  47.     }
  48.  
  49. weatherStation::weatherStation(string ID, string contact, double temperature)
  50.     {
  51.         stationDesignation = ID;
  52.         stationContact = contact;
  53.         stationTemperature = temperature;
  54.     }
  55.  
  56. class weatherStationSystem {
  57.         vector <weatherStation> List;
  58.         vector <weatherStation>::iterator ThroughTheList;
  59.         string fileName;///////////////////////////////////
  60.         double fahrenheitToCelsius(double);
  61.  
  62.     public:
  63.         weatherStationSystem();
  64.         void addWeatherStation();
  65.         void addTemperaturesPollen();
  66.         void showTemperatureReport();
  67.         void showTemperatureExtremes();
  68.         void showPollenReport();
  69.         void saveToFile();
  70.         string changeFileName();
  71.         void readFromFile();
  72.     };
  73.  
  74. double weatherStationSystem::fahrenheitToCelsius(double fahrenheitTemperature)
  75.     {
  76.         double celsiusTemperature = (5 * (fahrenheitTemperature - 32))/9;
  77.         return celsiusTemperature;
  78.     }
  79.  
  80. void weatherStationSystem::addWeatherStation()
  81.     {
  82.         string ID;
  83.         string contact;
  84.         weatherStation Buffer;
  85.  
  86.         cout << "Enter Station Information. Stop to Quit" << endl;
  87.         while(true){
  88.         cout << "Station Designation: ";
  89.         getline(cin, ID);
  90.         if(ID == "Stop")
  91.         break;
  92.         cout << "Contact Person: ";
  93.         getline(cin, contact);
  94.         Buffer.setDesignation(ID);
  95.         Buffer.setContact(contact);
  96.         List.push_back(Buffer);
  97.         }
  98.     }
  99.  
  100. void weatherStationSystem::addTemperaturesPollen()
  101.     {
  102.         double highPollen;
  103.         double lowPollen;
  104.         double temperature;
  105.         unsigned int K;
  106.         weatherStation Buffer;
  107.  
  108.         cout << "Enter reported temperatures" << endl;
  109.         for(K = 0; K < List.size(); K++){
  110.             cout << List[K].getDesignation() << endl;
  111.             cout << List[K].getContact() << endl;
  112.             cout << "Enter fahrenheit temperature: ";
  113.             cin >> temperature;
  114.             cout << "Enter high pollen count: ";
  115.             cin >> highPollen;
  116.             cout << "Enter low pollen count: ";
  117.             cin >> lowPollen;
  118.             Buffer.setTemperature(temperature);
  119.             Buffer.setHighCount(highPollen);
  120.             Buffer.setLowCount(lowPollen);
  121.             List.push_back(Buffer);
  122.         }
  123.     }
  124.  
  125. void weatherStationSystem::showTemperatureReport()
  126.     {
  127.         double MeanFahrenheitTemperature, MeanCelsiusTemperature;
  128.         double Total = 0; 
  129.         unsigned int K;
  130.  
  131.         for(K = 0 ; K < List.size() ; K++)
  132.             Total += List[K].getTemperature(); 
  133.             if(List.size() > 0) {
  134.                 MeanFahrenheitTemperature = Total / List.size();
  135.                 MeanCelsiusTemperature    = fahrenheitToCelsius(MeanFahrenheitTemperature);
  136.             }
  137.             else {
  138.                 cout << "The System Is Empty!" << endl;
  139.                 return;
  140.             }
  141.         cout << setprecision(3);
  142.         cout.setf(ios::showpoint);
  143.         cout << "\n\n\tNGS Daily Temperature Report" << endl;
  144.         cout << "================================================" << endl;
  145.         cout << "\t\t\t    Fahrenheit\tCelsius" << endl;
  146.         for(K = 0 ; K < List.size() ; K++)  {
  147.             cout << "------------------------------------------------" << endl;
  148.             cout << List[K].getDesignation() << ":\t\t\t" << List[K].getTemperature() 
  149.             << "\t" << fahrenheitToCelsius(List[K].getTemperature()) << endl;
  150.           }
  151.         cout << "------------------------------------------------" << endl;
  152.         cout << "Mean Temperature:       \t" <<  MeanFahrenheitTemperature << "\t" << MeanCelsiusTemperature << endl;
  153.         cout << "================================================\n\n" << endl;
  154.     }
  155.  
  156. void weatherStationSystem::showTemperatureExtremes()
  157.     {
  158.           double coldest, hottest;
  159.           unsigned int K;
  160.  
  161.           coldest = hottest = List[0].getTemperature();
  162.           for(K = 1 ; K < List.size() ; K++)  {
  163.                 if(List[K].getTemperature() < coldest)
  164.                       coldest = List[K].getTemperature();
  165.                 if(List[K].getTemperature() > hottest)
  166.                       hottest = List[K].getTemperature();
  167.           }
  168.           cout.setf(ios::showpoint);
  169.           cout << setprecision(3);
  170.  
  171.           cout << "\n\n========NGS Temperature Data Report========" << endl;
  172.           cout << "\t\t    Fahrenheit\tCelsius" << endl;
  173.           cout << "-------------------------------------------" << endl;
  174.           cout << "Lowest Temperature:\t" << coldest << "\t" << fahrenheitToCelsius(coldest) << endl;
  175.           cout << "-------------------------------------------" << endl;
  176.           cout << "Highest Temperature:\t" << hottest << "\t" << fahrenheitToCelsius(hottest)  << endl;
  177.           cout << "-------------------------------------------" << endl;
  178.           cout << "========End Temperature Data Report========\n" << endl;
  179.     }
  180.  
  181. void weatherStationSystem::showPollenReport()
  182.     {
  183.         unsigned int K;
  184.  
  185.         cout << setprecision(3);
  186.         cout.setf(ios::showpoint);
  187.  
  188.         cout << "\n\n\tNGS Daily Pollen Report" << endl;
  189.         cout << "================================================" << endl;
  190.         for(K = 0 ; K < List.size() ; K++)  {
  191.             cout << List[K].getDesignation() << ":\t" << List[K].getMeanCount() << endl;
  192.         }
  193.         cout << "================================================\n\n" << endl;
  194.     }
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209. string weatherStationSystem::changeFileName()
  210.     {
  211.         cout << "Enter new file name: ";
  212.             getline(cin, fileName);
  213.         cout << "The new file name is " << fileName;
  214.         return fileName;
  215.     }
  216.  
  217. void weatherStationSystem::saveToFile()
  218.     {
  219.         fstream OutFile(fileName.c_str(), ios::out);
  220.  
  221.         for(ThroughTheList = List.begin() ; ThroughTheList < List.end() ; ThroughTheList++)
  222.             OutFile << ThroughTheList -> getContact() << endl;
  223.             OutFile << ThroughTheList -> getDesignation() << endl;
  224.             OutFile << ThroughTheList -> getTemperature() << endl;
  225.             OutFile << ThroughTheList -> getHighCount() << endl;
  226.             OutFile << ThroughTheList -> getLowCount() << endl;
  227.  
  228.         OutFile.close();
  229.     }
  230.  
  231. void weatherStationSystem::readFromFile()
  232. {
  233.     fstream InFile(fileName.c_str(), ios::in);
  234.  
  235.     for(ThroughTheList = List.begin() ; ThroughTheList < List.end() ; ThroughTheList++)
  236.         InFile << ThroughTheList -> getContact() << endl;
  237.         InFile << ThroughTheList -> getDesignation() << endl;
  238.         InFile << ThroughTheList -> getTemperature() << endl;
  239.         InFile << ThroughTheList -> getHighCount() << endl;
  240.         InFile << ThroughTheList -> getLowCount() << endl;
  241. }
  242.  
  243. void menu()////////////////May be LNK2019
  244. {
  245.     cout << "Choices" << endl;
  246.     cout << "Add Stations" << endl;
  247.     cout << "Post Station Info" << endl;
  248.     cout << "Daily Report" << endl;
  249.     cout << "High-Low Report" << endl;
  250.     cout << "Daily Pollen Count" << endl;
  251.     cout << "Change File Name" << endl;
  252.     cout << "Save To File" << endl;
  253.     cout << "Read From File" << endl;
  254.     cout << "Quit" << endl;
  255. }
  256.  
  257. class weatherSystemUI : weatherStationSystem  {
  258.       weatherStationSystem weatherMatrix;
  259.  
  260. public:
  261.       weatherSystemUI();
  262.  
  263. };
  264.  
  265. weatherSystemUI::weatherSystemUI()
  266. {
  267.       string command;    
  268.  
  269.       while(true)  {  //Command loop
  270.             menu();
  271.             cout << "Enter Command: ";
  272.             getline(cin, command);
  273.             if(command == "Quit")
  274.                   break;
  275.             else if(command == "Enter Stations")
  276.                 weatherMatrix.addWeatherStation();
  277.             else if(command == "Enter Temperatures and Pollen Counts")
  278.                 weatherMatrix.addTemperaturesPollen();
  279.             else if(command == "Daily Report")
  280.                 weatherMatrix.showTemperatureReport();
  281.             else if(command == "High-Low Report")
  282.                 weatherMatrix.showTemperatureExtremes();
  283.             else if(command == "Daily Pollen Count")
  284.                 weatherMatrix.showPollenReport();
  285.             else if(command == "Change File Name")
  286.                 weatherMatrix.changeFileName();
  287.             else if(command == "Save To File")
  288.                 weatherMatrix.saveToFile();
  289.             else if(command == "Read From File")
  290.                 weatherMatrix.readFromFile();
  291.       }
  292. }
  293.  
  294.  
  295.  
  296.  
  297. int main()
  298. {
  299.     weatherSystemUI BayArea;
  300. }
Aug 7 '09 #1
1 3381
JosAH
11,448 Expert 8TB
You have declared a constructor weatherStationSystem() but you have never defined it (so it isn't there; that's what the linker complains about).

kind regards,

Jos
Aug 7 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Jim | last post by:
All, I'm trying to debug a Python GPF while running a script that we've written. After fixing up some of the paths for the Python build and successfully building Python from ActiveState source,...
5
by: cschettle | last post by:
I think you need to link with msvcrt.lib ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000...
3
by: YAN KANG / SU | last post by:
Hi, All I am migrating to Studio .NET 2003 from Studio 6.0 and Studio .NET 2002. When I compiled my code, which is compilable both in VC++ 6.0 and Studio .NET 2002, I have an error LNK2019 as the...
6
by: Pucca | last post by:
Hi, I have a few C BER coding that I would like to compile into a C++ Class library project and then use it in my C# windows application. Can I do that from C# using pinvoke? If not then does...
3
by: Edward Mitchell | last post by:
I am converting a project that uses DirectX and worked under VS.NET 2003. Now when I convert the project to .NET 2005, there are linker errors for _Xran and _Xlen as follows: ...
6
by: robintw | last post by:
Hi all, I'm trying to use some functions which are in an external library file called qhdlc.lib from within my C++ .Net program. I have a header file for this library (qhdlc.h) and have set the...
12
by: Manjunath.M | last post by:
Hi, In my project I got this error when adding another project from internet to mine. I have written a Project in C which creates an exe file. I want to include this Project into another...
7
by: JustBeSimple | last post by:
Hi Everyone, I'm having a problem compiling useing the VS2005 .NET I need help to resolve those error, I try to create a new project it doesn't help any suggestion? I got the following errors:...
2
by: =?Utf-8?B?YmFzaA==?= | last post by:
Hello, I am compiling a CPP code using Visual studion .net 2003. I get the following error, despite having windldap.h and wldap32.dll in my include and lib paths. Here is the error. uuid.lib...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.