I have been googeling every possible solution, but I cannot seem to fix LNK2019. My code is below, but I just cannot understand how anything related to LNK2019 from Microsoft's help center applies to it. GRRRRRR. The error says
1>Lab Four.obj : error LNK2019: unresolved external symbol "void __cdecl highLowReport(c lass weatherStation * const,int)" (?highLowReport @@YAXQAVweather Station@@H@Z) referenced in function _main
1>Lab Four.obj : error LNK2019: unresolved external symbol "void __cdecl dailyReport(cla ss weatherStation * const,int)" (?dailyReport@@ YAXQAVweatherSt ation@@H@Z) referenced in function _main
1>Lab Four.obj : error LNK2019: unresolved external symbol "void __cdecl postTemperature s(class weatherStation * const,int)" (?postTemperatu res@@YAXQAVweat herStation@@H@Z ) referenced in function _main
This is my code... -
#include <iostream>
-
#include <string>
-
using namespace std;
-
-
class weatherStation
-
{
-
string stationDesignation; //Identifies the station
-
string stationAgent; //Who's responsible
-
double fTemperature; //how hot it is
-
double cTemperature;
-
-
public:
-
void setDesignation(string ID) {stationDesignation = ID;}
-
void setAgent(string agent) {stationAgent = agent;}
-
void setFTemperature(double fDegree) {fTemperature = fDegree;}
-
void setCTemperature(double cDegree) {cTemperature = cDegree;}
-
-
string getDesignation() {return stationDesignation;}
-
string getAgent() {return stationAgent;}
-
double getTemperature() {return fTemperature;}
-
double getcTemperature() {return cTemperature;}
-
-
void Displayer();
-
void postTemperatures(weatherStation list[], int numItems);
-
void dailyReport(weatherStation list[], int numItems);
-
void highLowReport(weatherStation list[], int numItems);
-
};
-
void weatherStation::Displayer()
-
{
-
cout << "--------------------------------------" << endl;
-
cout << "Station:\t " << stationDesignation << endl;
-
cout << "Agent:\t " << stationAgent << endl;
-
cout << "Current Temperature: " << fTemperature << "\t" << cTemperature << endl;
-
cout << "--------------------------------------" << endl;
-
}
-
-
void menu();
-
int addStations(weatherStation[]);
-
void postTemperatures(weatherStation[], int);
-
void dailyReport(weatherStation [], int);
-
void highLowReport(weatherStation[], int);
-
-
-
-
-
int main()
-
{
-
weatherStation list[100];
-
string command;
-
int numItems;
-
cout << "Type Menu to view menu";
-
for(;;)
-
{
-
cout << "Enter command: " << endl;
-
getline(cin, command);
-
if(command == "Menu")
-
menu();
-
else if(command == "Add Stations")
-
numItems = addStations(list);
-
else if(command == "Post Temperatures")
-
postTemperatures(list, numItems);
-
else if(command == "Daily Report")
-
dailyReport(list, numItems);
-
else if(command == "High-Low Report")
-
highLowReport(list, numItems);
-
else if(command == "Quit")
-
break;
-
}
-
}
-
-
void menu()
-
{
-
cout << "Menu" << endl;
-
cout << "-----------------" << endl;
-
cout << "Add Stations" << endl;
-
cout << "Post Temperatures" << endl;
-
cout << "Daily Report" << endl;
-
cout << "High-Low Report" << endl;
-
cout << "Quit" << endl;
-
cout << "-----------------" << endl;
-
}
-
-
int addStations(weatherStation list[])
-
{
-
int K = 0;
-
string ID, agent;
-
cout << "Enter Station Information Below, Stop To Quit" << endl;
-
cout << "-----------------------------------" << endl;
-
for(;;)
-
{
-
cout << "Enter Station Designation: ";
-
getline(cin, ID);
-
if(ID == "Stop")
-
break;
-
cout << "Enter Contact Agent: ";
-
getline(cin, agent);
-
list[K].setDesignation(ID);
-
list[K].setAgent(agent);
-
K++;
-
cout << "-----------------------------------" << endl;
-
cout << "-----------------------------------" << endl;
-
}
-
return K;
-
}
-
-
void weatherStation::postTemperatures(weatherStation list[], int numItems)
-
{
-
int A = 0;
-
double temperature;
-
-
cout << "Enter reported fahrenheit temperatures" << endl;
-
cout << endl;
-
-
for(A = 0; A < numItems; A++)
-
{
-
cout << "Weather Station " << stationDesignation << endl;
-
cout << "Agent " << stationAgent << endl;
-
cout << "Temperature = ";
-
cin >> temperature;
-
list[A].setFTemperature(temperature);
-
list[A].setCTemperature((5*(temperature-32)/9));
-
}
-
-
cout << endl;
-
cout << "--------------------------------------------------" << endl;
-
}
-
-
void weatherStation::dailyReport(weatherStation list[], int numItems)
-
{
-
int A = 0;
-
double fTotal = 0;
-
double cTotal = 0;
-
-
cout << "NGS Daily Temperature Report" << endl;
-
cout << "================================================" << endl;
-
cout << "\tFahrenheit\tCelsius" << endl;
-
cout << "------------------------------------------------" << endl;
-
for(A = 0; A < numItems; A++)
-
{
-
cout << stationDesignation << ": " << fTemperature << "\t" << cTemperature << endl;
-
cout << "------------------------------------------------" << endl;
-
fTotal += fTemperature;
-
cTotal += cTemperature;
-
}
-
cout << "Mean Temperature: " << fTotal << "\t" << cTotal;
-
cout << "================================================" << endl;
-
}
-
-
void weatherStation::highLowReport(weatherStation list[], int numItems)
-
{
-
int K = 0;
-
double highestF = 0;
-
double lowestF = 0;
-
double highestC = 0;
-
double lowestC = 0;
-
-
//Identifying highest and lowest temperatures
-
for (K = 0; K < numItems; K++)
-
{
-
if(fTemperature > highestF)
-
highestF = fTemperature;
-
}
-
-
for (K = 0; K < numItems; K++)
-
{
-
if(fTemperature < lowestF)
-
lowestF = fTemperature;
-
}
-
-
for (K = 0; K < numItems; K++)
-
{
-
if(cTemperature > highestC)
-
highestC = cTemperature;
-
}
-
-
for (K = 0; K < numItems; K++)
-
{
-
if(cTemperature < lowestC)
-
highestC = cTemperature;
-
}
-
-
cout << "NGS High-Low Temperature Report" << endl;
-
cout << "===============================================" << endl;
-
cout << "\t\t Fahrenheit" << "\t\tCelsius" << endl;
-
cout << "-----------------------------------------------" << endl;
-
cout << "Lowest Temperature: " << lowestF << "\t\t" << lowestC << endl;
-
cout << "-----------------------------------------------" << endl;
-
cout << "Highest Temperature: " << highestF << "\t\t" << highestC << endl;
-
cout << "-----------------------------------------------" << endl;
-
cout << "End Temperature Data Report" << endl;
-
}
-
1 15085
int addStations(wea therStation[]);
void postTemperature s(weatherStatio n[], int);
void dailyReport(wea therStation [], int);
void highLowReport(w eatherStation[], int);
These functions are global declared but not defined. On the other hand your class methods that are defined never get called.
To illustrate my point, look at the following pseudo code:
void my_method(); // let's call this func Fred
class MyClass {
public: void my_method(); // let's call this func Barney
}
MyClass object;
object.my_metho d(); // correct, calls Barney
my_method(); // incorrect - calls Fred
void object::my_meth od() { ... } // defines Barney
void my_method() { ... } // defines Fred
What you are doing instead is just calling the global function, which would normally result in compiler error, but since you have declared yet not defined global function with the same name and params, you get linker errors instead.
If what I'm saying is not clear, you should go read up on some C++ textbook about class methods (also called member functions). Come back if you still have questions after that.
Sign in to post your reply or Sign up for a free account.
Similar topics |
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:
|
by: KS |
last post by:
I am getting linker error for a code that was tested and
running. I opened the project in VS.NET 2003 and now i
get these errors - I am sure it is some options issue.
Can anyone please help?
Linking...
atls.lib(atlbase.obj) : error LNK2001: unresolved
external symbol ___security_cookie
PenPacketInfoDlg.obj : error LNK2019: unresolved...
|
by: Eric |
last post by:
Hello
I receive (only in Release build) the following linker warning:
LINK : warning LNK4089: all references to 'WS2_32.dll' discarded by /OPT:REF
If I set WS2_32.lib in project properties under ignore specific library,
then I receive:
ABContainer.obj : error LNK2019: unresolved external symbol
|
by: Senapathy |
last post by:
VC++ .NET 2003 Standard Edition
Win XP, SP2
Hi,
I have a code that builds under VC6.0, but fails to link in VC7.1.
The offending code is as follows:
_AFX_RICHEDIT_STATE* const pEditState = _afxRichEditState;
|
by: Chucker |
last post by:
Hi Folks,
I got a Wrapper Dll around a native C++ static library. In .NET 1.1 this
worked fine. When moving to .NET 2.0 I get a couple of unresolved externals /
linker errors:
Error 16 error LNK2028: unresolved token (0A000007) "extern "C" void
__clrcall ___CxxCallUnwindDtor(void (__clrcall*)(void *),void *)"...
| |
by: VivekR |
last post by:
I have a MFC application developed using VC++ 5. Recently I ported that
to VC++ 7.1 and now I am trying to compile the MFC application with
/CLR under VC++ 7.1. And I get linker errors referring to one of the
libraries that the project uses. Without the /CLR, the project compiles
and runs well.
There is some library by name task.lib and the...
|
by: developer |
last post by:
Hi All
I have made a .NET project.
the files included are borland c++ files that i am migrate to VC++ .NET
I am using Microsoft Visual C++ .NET 2003.
the compilation goes through properly, but throws a load of linker
errors
|
by: iiitsunny |
last post by:
i have ported one project which was working in VC6 to VC7. Now the project is working fine in VC7 also. I have made some additions in VC7 environment only. But the problem is that the project is not working in the release mode. I mean it is shooting off linking errors. I am required to generate an exe file and am looking for some suggestions!!!...
|
by: bajajv |
last post by:
Hi,
While implementing CList class, I got linker errors for constructor and destructor. Below is the code -
template<class TYPE, class ARG_TYPE = const TYPE&>
class CList
{
protected:
struct CNode
{
CNode* pNext;
|
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...
|
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...
| |
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
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...
|
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...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
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...
| |