| | |
Please find and correct the error in my c++ program. "Linker Error: Undefined symbol
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Nov 2006
Posts: 224
Reputation:
Solved Threads: 31
Please find and correct the error in my c++ program. "Linker Error: Undefined symbol
0
#1 Feb 24th, 2009
Please find and correct the error in my c++ program. "Linker Error: Undefined symbol _main in module c0.ASM"
The program is for transfering content of one file to another.
#include<fstream.h>
#include<iostream.h>
#include<conio.h>
class student
{
int rollno;
char name[20];
int tm;
public:
void input();
void transfer();
void output();
}
obj;
void student::input()
{
char ch='y';
ofstream outf;
outf.open("mark.dat");
while(ch=='y')
{
cout<<"Enter rollno, name and mark";
cin>>rollno>>name>>tm;
outf.write((char*)&obj,sizeof(obj));
cout<<"wish to enter more(Y/N)";
cin>>ch;
}
outf.close();
}
void student::transfer()
{
ofstream outf;
ifstream inf;
inf.open("mark.dat");
inf.open("trans.dat");
while(inf)
{
inf.read((char*)&obj,sizeof(obj));
outf.write((char*)&obj,sizeof(obj));
}
outf.close();
inf.close();
}
void student::output()
{
ifstream inf;
inf.open("trans.dat");
while(inf)
{
inf.read((char*)&obj,sizeof(obj));
cout<<"Rollno"<<rollno;
cout<<"Name"<<name;
cout<<"Total"<<tm;
}
getch();
inf.close();
}
The error i get is
compiling 10.cpp
linking ...\OUTPUT\10.EXE
.Linker Error: Undefined symbol _main in module c0.ASM
I think the error is due to the missing of void main. But i don't know where i should put it.
The program is for transfering content of one file to another.
#include<fstream.h>
#include<iostream.h>
#include<conio.h>
class student
{
int rollno;
char name[20];
int tm;
public:
void input();
void transfer();
void output();
}
obj;
void student::input()
{
char ch='y';
ofstream outf;
outf.open("mark.dat");
while(ch=='y')
{
cout<<"Enter rollno, name and mark";
cin>>rollno>>name>>tm;
outf.write((char*)&obj,sizeof(obj));
cout<<"wish to enter more(Y/N)";
cin>>ch;
}
outf.close();
}
void student::transfer()
{
ofstream outf;
ifstream inf;
inf.open("mark.dat");
inf.open("trans.dat");
while(inf)
{
inf.read((char*)&obj,sizeof(obj));
outf.write((char*)&obj,sizeof(obj));
}
outf.close();
inf.close();
}
void student::output()
{
ifstream inf;
inf.open("trans.dat");
while(inf)
{
inf.read((char*)&obj,sizeof(obj));
cout<<"Rollno"<<rollno;
cout<<"Name"<<name;
cout<<"Total"<<tm;
}
getch();
inf.close();
}
The error i get is
compiling 10.cpp
linking ...\OUTPUT\10.EXE
.Linker Error: Undefined symbol _main in module c0.ASM
I think the error is due to the missing of void main. But i don't know where i should put it.
--
Index of mp3
Index of mp3
•
•
Join Date: Nov 2006
Posts: 224
Reputation:
Solved Threads: 31
Re: Please find and correct the error in my c++ program. "Linker Error: Undefined symbol
0
#2 Feb 24th, 2009
think i got this from my friend
void main()
{
student obj;
obj.input();
obj.transfer();
obj.output();
getch();
}
He told to put it at last but hwo do i do that?
void main()
{
student obj;
obj.input();
obj.transfer();
obj.output();
getch();
}
He told to put it at last but hwo do i do that?
--
Index of mp3
Index of mp3
•
•
Join Date: Nov 2006
Posts: 224
Reputation:
Solved Threads: 31
Re: Please find and correct the error in my c++ program. "Linker Error: Undefined symbol
0
#3 Feb 24th, 2009
I found the error and corrected it.
#include<fstream.h>
#include<iostream.h>
#include<conio.h>
class student
{
int rollno;
char name[20];
int tm;
public:
void input();
void transfer();
void output();
}
obj;
void student::input()
{
char ch='y';
ofstream outf;
outf.open("mark.dat");
while(ch=='y')
{
cout<<"Enter rollno, name and mark";
cin>>rollno>>name>>tm;
outf.write((char*)&obj,sizeof(obj));
cout<<"wish to enter more(Y/N)";
cin>>ch;
}
outf.close();
}
void student::transfer()
{
ofstream outf;
ifstream inf;
inf.open("mark.dat");
inf.open("trans.dat");
while(inf)
{
inf.read((char*)&obj,sizeof(obj));
outf.write((char*)&obj,sizeof(obj));
}
outf.close();
inf.close();
}
void student:utput()
{
ifstream inf;
inf.open("trans.dat");
while(inf)
{
inf.read((char*)&obj,sizeof(obj));
cout<<"Rollno"<<rollno;
cout<<"Name"<<name;
cout<<"Total"<<tm;
}
inf.close();
}
void main()
{
student obj;
obj.input();
obj.transfer();
obj.output();
getch();
}
#include<fstream.h>
#include<iostream.h>
#include<conio.h>
class student
{
int rollno;
char name[20];
int tm;
public:
void input();
void transfer();
void output();
}
obj;
void student::input()
{
char ch='y';
ofstream outf;
outf.open("mark.dat");
while(ch=='y')
{
cout<<"Enter rollno, name and mark";
cin>>rollno>>name>>tm;
outf.write((char*)&obj,sizeof(obj));
cout<<"wish to enter more(Y/N)";
cin>>ch;
}
outf.close();
}
void student::transfer()
{
ofstream outf;
ifstream inf;
inf.open("mark.dat");
inf.open("trans.dat");
while(inf)
{
inf.read((char*)&obj,sizeof(obj));
outf.write((char*)&obj,sizeof(obj));
}
outf.close();
inf.close();
}
void student:utput()
{
ifstream inf;
inf.open("trans.dat");
while(inf)
{
inf.read((char*)&obj,sizeof(obj));
cout<<"Rollno"<<rollno;
cout<<"Name"<<name;
cout<<"Total"<<tm;
}
inf.close();
}
void main()
{
student obj;
obj.input();
obj.transfer();
obj.output();
getch();
}
--
Index of mp3
Index of mp3
•
•
Join Date: Nov 2006
Posts: 224
Reputation:
Solved Threads: 31
Re: Please find and correct the error in my c++ program. "Linker Error: Undefined symbol
0
#4 Feb 24th, 2009
I still have another problem. That is when the while loop asks continue(y/n)
When i enter n it just stuck there.
I need to make the program error free urgently. Please reply with solution. I use borland turbo c++ 3
When i enter n it just stuck there.
I need to make the program error free urgently. Please reply with solution. I use borland turbo c++ 3
Last edited by bugmenot; Feb 24th, 2009 at 12:20 pm.
--
Index of mp3
Index of mp3
![]() |
Other Threads in the C++ Forum
- Previous Thread: C++ do-while command & scoring!!!
- Next Thread: HELP!!!Wrote a program to calculate sales tax but wont run properly.
| Thread Tools | Search this Thread |
api array based beginner binary c++ c/c++ calculator char char* class classes code compile compiler console conversion count delete deploy desktop directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory news numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets





