473,699 Members | 2,628 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with Unresolved External.

I'm currently working on a class "Course" and I'm getting an
unresolved external error when trying to compile.

I understand that unresolved externals are caused by declaration of
methods that are not defined, but I think I defined all my methods so
this one has got me stumped. Any help would be much appreciated.

Thank you for your time,

Kyle

course.h
--------
#ifndef COURSE_H
#define COURSE_H

#include <string>
using namespace std;

class Course
{
private:
string id;
int credithours;
string instructor;
string days;
string time;
string room;
int capacity;
string roster[50];
int size;
public:
Course();// Default Constructor
void ReadCourse(istr eam & fin);// Reads course information from
file.
void WriteCourse(ost ream & fout);// Writes course information to
file.
void PrintData();// Prints's all data except roster to screen with
labels.
void PrintRoster(ost ream & out);// Prints Roster to any output
stream.
void AddStudent(ostr eam & out, string newstudent);// Adds student to
roster.
};

#endif
Course.cpp
----------
#include "course.h"
#include <iostream>
using namespace std;

Course::Course( )
{
id="0";
}

void Course::ReadCou rse(istream & fin)// Reads course information from
file.
{
fin >> id;
fin >> credithours;
getline(fin, instructor);
fin >> days;
getline(fin, time);
getline(fin, room);
fin >> capacity;
fin >> size;
for (int i=0; i<=size; i++)
{
getline(fin, roster[i]);
}
}

void Course::WriteCo urse(ostream & fout)// Writes course information
to file.
{
fout << id << " " << credithours << "\n";
fout << instructor << "\n";
fout << days << " " << time << "\n";
fout << room << "\n";
fout << capacity << " " << size << "\n";
for (int i=0; i<=size; i++)
{
fout << roster[i] << "\n";
}
}

void Course::PrintDa ta()// Prints's all data except roster to screen
with labels.
{
cout << "Course ID: " << id << endl;
cout << "Credits: " << credithours << endl;
cout << "Instructor : " << instructor << endl;
cout << "Days and Time: " << days << " " << time << endl;
cout << "Capacity: " << capacity << endl;
cout << "Enrolled: " << size << endl;
}

void Course::PrintRo ster(ostream & out)// Prints Roster to any output
stream.
{
for (int i=0; i<=size; i++)
{
out << roster[i] << endl;
}
}

void Course::AddStud ent(ostream & out, string newstudent)// Adds
student to roster.
{
size+=1;
roster[size]=newstudent;
}

ERROR:
LIBCD.lib(crt0. obj) : error LNK2019: unresolved external symbol _main
referenced in function _mainCRTStartup
Debug/Project 1.exe : fatal error LNK1120: 1 unresolved externals
Jul 22 '05 #1
2 1599
CoolDudeMan wrote:

I'm currently working on a class "Course" and I'm getting an
unresolved external error when trying to compile.
It is the *linker* which emits this message, not the compiler.
The linker is trying to assemble the complete executable. And in doing
so, it noticed that:

ERROR:
LIBCD.lib(crt0. obj) : error LNK2019: unresolved external symbol _main
referenced in function _mainCRTStartup
Debug/Project 1.exe : fatal error LNK1120: 1 unresolved externals


There is no main() function in your program!

--
Karl Heinz Buchegger
kb******@gascad .at
Jul 22 '05 #2
Ah, doh.

My apologies for my vocabulary (still learning all this stuff. :) )
but I see the problem now. You just can't build solutions without
having a mainline function to execute it.

So, in the future, as long as it gets to the "Linking... " step w/o any
errors, than the classes and it's implementation and interface files
are okay.

Thanks for the help Karl! :)

-Kyle
Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2800
by: Ida | last post by:
Hi, I am trying to build an dll with Microsoft Visual C++ but during the linking phase I get linking errors. Script.obj : error LNK2019: unresolved external symbol __imp__PyString_AsString referenced in function "public: static struct _object * __cdecl SomeFunctionName Script.obj : error LNK2019: unresolved external symbol __imp__PyObject_Repr referenced in function "public: static struct _object * __cdecl
2
7316
by: ozgan.net | last post by:
Hi everyone, I created my first COM object, but I took below errors. Why I didn't use socket functions. I defined *.def file __imp__WSAStartup@8 PRIVATE __imp__socket@12 PRIVATE __imp__htons@4 PRIVATE __imp__connect@12 PRIVATE __imp__recv@16 PRIVATE
4
3376
by: BinWang85 | last post by:
The following is the code: #include <iostream.h> #include <math.h> //needed for decimal calculations int main() { int employee_num; double FetchHours(void);
1
2157
by: Vishal Saxena | last post by:
Hi, I am new to this news group, hope to get prompt solution from you, gurus of VC. Well i had a project developed in VC++ 6.0, it uses Adobe Plugin Development SDK, I am trying to upgrade my project to VC++.NET, below is the code snipplet from the project
1
2125
by: Hadi | last post by:
Hi, I have two files libqdbm.dll.a and qdbm.dll. In cygwin libqdbm.dll.a is located in /usr/local/lib while qdbm.dll is located in windows/system32. I have my test project which I compiled in cygwin using the following command: gcc -I/usr/local/include -o test test.c -L/usr/local/lib -lqdbm
5
17717
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 =---
1
2178
by: dasilva109 | last post by:
Hi guys I am new to C++ and need urgent help with this part of my code for a uni coursework I have to submit by Thursday //ClientData.h #ifndef CLIENTDATA_H #define CLIENTDATA_H #include <string>
2
2753
by: dasilva109 | last post by:
Hi guys I am new to C++ and need urgent help with this part of my code for a uni coursework I have to submit by Thursday //ClientData.h #ifndef CLIENTDATA_H #define CLIENTDATA_H #include <string>
2
7147
by: Maydogg6 | last post by:
I need a hand with some stubborn link errors. I'm trying to recreate and old program from 6.0 into .NET, but for some reason when I try to compile I'm getting linking errors for all my function calls that deal with sockets. I've included <winsock2.h> in stdafx.h and I linked to ws2_32.lib by going to project properties->linker->general->additional library directories and typing in ws2_32.lib. Am I missing some include files or have the...
3
3163
by: curious2007 | last post by:
I am getting the following type of error: 1>Compiling manifest to resources... 1>Linking... 1>main.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall MatrixIterativeSolver<double,int>::~MatrixIterativeSolver<double,int>(void)" (??1?$MatrixIterativeSolver@NH@@UAE@XZ) referenced in function _main 1>main.obj : error LNK2019: unresolved external symbol "public: virtual class Vector<double,int,class...
0
8613
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
9172
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
9032
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...
1
8908
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6532
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
5869
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();...
0
4374
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3054
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 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.