473,668 Members | 2,383 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can't Find Unresolved External Symbol LNK2019

6 New Member
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 weatherStationS ystem::weatherS tationSystem(vo id)" (??0weatherStat ionSystem@@QAE@ XZ) referenced in function "public: __thiscall weatherSystemUI ::weatherSystem UI(void)" (??0weatherSyst emUI@@QAE@XZ)
1>C:\Users\yuhw achiang\Documen ts\Visual Studio 2008\Projects\L ab 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 3404
JosAH
11,448 Recognized Expert MVP
You have declared a constructor weatherStationS ystem() 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
1682
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, I compiled the Python Extensions, but am getting the following error:
5
17715
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 Newsgroups ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
3
5845
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 following ------------------------------------------------------------------------- error LNK2019: unresolved external symbol "class CPV3<double> __cdecl operator*(double,class CPV3<double> const &)" (??D@YA?AV?$CPV3@N@@NABV0@@Z) referenced in...
6
5366
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 anyone how can I call these functions from C#? -- Thanks.
3
4851
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: dx9.lib(WinConsole.obj) : error LNK2019: unresolved external symbol "public: void __thiscall std::_String_base::_Xran(void)const " ... .... dx9.lib(WinConsole.obj) : error LNK2019: unresolved external symbol "public: void __thiscall...
6
1982
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 library as an "additional dependency" in Project Properties->Linker->Input. Even though I have done all of that, I still get unresolved token errors for every function in the library. Sadly, I do not have access to the source code for the library -...
12
1518
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 Project. When I try to add I got this error : " unresolved external symbol error "
7
3104
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: vector_main.obj : error LNK2019: unresolved external symbol "public: __thiscall Vector<int>::~Vector<int>(void)" (??1?$Vector@H@@QAE@XZ) referenced in function _main
2
2713
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 rpcrt4.lib ole32.lib oleaut32.lib uuid.lib Creating library libsq00.lib and object libsq00.exp libq00.lib(ootb.obj) : error LNK2019: unresolved external symbol _ldap_unbind@4
0
8459
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8378
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8890
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8791
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8653
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6206
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5677
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
2018
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1783
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.