Apr 3, 2014 at 1:57am UTC
So I decided to start again with the linked student list again. I have to use linked list to display a student's name, id, and gpa. I am having problems with trying to get it to load. The error message is:
1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
1>C:\Users\JEGeorge\Documents\Visual Studio 2010\Projects\lab2021\Debug\lab2021.exe : fatal error LNK1120: 1 unresolved externals
1>
1>Build FAILED.
I don't understand what I'm doing wrong. where is my error? Thank you in advance.
main cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
//main.cpp
#include<iostream>
#include "Student.h"
#include "Folder.h"
using namespace std;
int main()
{
Folder rec;
string name;
int id;
double gpa;
while (true )
{
cout<<"Enter name (or quit to exit): " <<endl;
cin>>name;
if (name=="quit" ) break ;
cout<<"Enter ID number: " <<endl;
cin>>id;
cout<<"Enter GPA: " <<endl;
cin>>gpa;
rec.addStudent(name, id, gpa);
}
rec.traverseList();
system("pause" );
return 0;
}
folder cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
#include "Folder.h"
#include "Student.h"
#include<iostream>
#include<string>
Folder::Folder()
{
root=new Student();
root=NULL;
}
Folder::~Folder()
{
delete root;
}
void Folder::addStudent(string &name, int &id, double &gpa)
{
Student *new_student = new Student (name, id, gpa);
if (root==NULL)
{
root=new_student;
return ;
}
else
{
Student *temp_node=root;
while (temp_node->next !=NULL)
{
temp_node=temp_node->next;
}
temp_node->next= new_student;
}
}
void Folder::traverseList()
{
Student *temp_node=root;
while (temp_node !=NULL)
{
cout<<temp_node->name<<endl;
temp_node=temp_node->next;
}
}
student cpp
1 2 3 4 5 6 7 8 9 10 11 12 13
#include "Student.h"
Student::Student()
{
}
Student::Student(string& n, int & i, double & g)
{
name=n;
id=i;
gpa=g;
next=NULL;
}
folder.h
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
//Folder.h
#pragma once
#include<string>
using namespace std;
class Student;
class Folder
{
private :
Student *root;
public :
Folder();
~Folder();
void addStudent (string&, int &, double &);
void traverseList();
};
student.h
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
//Student.h
#pragma once
#include<string>
#include<iostream>
using namespace std;
class Student
{
friend class Folder;
private :
string name;
int id;
double gpa;
Student *next;
public :
Student();
Student(string&, int &, double &);
};
Last edited on Apr 3, 2014 at 1:25pm UTC