By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,605 Members | 1,391 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,605 IT Pros & Developers. It's quick & easy.

Please Help Me

P: 6
Hello, hello...
can somebody please help me...
I am having this problem with my source code[Linker Error] Unresolved external 'ProductList::Print(Stdctrls::TMemo *)' referenced from C:\DOCUMENTS AND SETTINGS\DOCUMENTS\DESKTOP\FOLDER\UNIT1.OBJ.
Source code is going to be devided in three parts because of its length?
PART1
//---------------------------------------------------------------------------

#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include"Product.h"
#include"ProductList.h"
#include <Dialogs.hpp>
//---------------------------------------------------------------------------
class TMainForm : public TForm
{
__published: // IDE-managed Components
TButton *Button1;
TOpenDialog *OpenDialog1;
TLabel *Label1;
TLabel *Label2;
TLabel *Label3;
TLabel *Label4;
TLabel *Label5;
TMemo *Memo1;
void __fastcall Button1Click(TObject *Sender);
private: // User declarations
ProductList *theProduct;
public: // User declarations
__fastcall TMainForm(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TMainForm *MainForm;
//---------------------------------------------------------------------------
#endif

//---------------------------------------------------------------------------
#include <stdio.h>
#include <vcl.h>
#pragma hdrstop
#include<fstream.h>
#include "Unit1.h"
#include "Product.h"
#include"ProductList.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
using namespace std;

TMainForm *MainForm;
//---------------------------------------------------------------------------
__fastcall TMainForm::TMainForm(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TMainForm::Button1Click(TObject *Sender)
{/* char buff[80];
ifstream infile("unit.txt");
if(infile.is_open())
{
while(!infile.eof())
{

infile.getline(buff,sizeof(buff));
Memo1->Lines->Add(buff);
Label1->Caption = buff;

}
}*/
theProduct->Print(Memo1);



}

//---------------------------------------------------------------------------


Thank you in Advance

Bujar METAJ
Nov 16 '06 #1
Share this Question
Share on Google+
2 Replies


P: 6
Part2

//---------------------------------------------------------------------------

#ifndef ProductH
#define ProductH
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>

//---------------------------------------------------------------------------
class Product{
private:
char id;
char name;
double price;
double weight;
double vatPrice;

public:
//accessor function for id
char getid();
//accessor function for id
char getname();
//accessor function for id
double getprice();
//accessor function for id
double getweight();
//accessor function for id
double getvatPrice();
void products();
Product();
Product(char aid,char aname,double aprice,
double aweight, double avatPrice);
~Product();
};
#endif
#include <vcl.h>
#pragma hdrstop
//---------------------------------------------------------------------------
#include <stdio.h>

#include<string>
#include<fstream.h>
#include<iostream>
#pragma hdrstop
#include "Product.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
using namespace std;

Product::Product()
{
}
Product::Product(char aid,char aname,double aprice,
double aweight, double avatPrice){
id = aid;
name = aname;
price = aprice;
weight = aweight;
vatPrice = avatPrice;
}
char Product::getid()
{
return id; }
char Product::getname()
{
return id; }
double Product::getweight(){
return weight;}
double Product::getprice(){
return price;}
double Product::getvatPrice(){
return vatPrice;}

Product::~Product(){
delete current;
}

Thank you
Nov 16 '06 #2

P: 6
Re: Linking Error
--------------------------------------------------------------------------------

Part3
//---------------------------------------------------------------------------
#include <Dialogs.hpp>
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <Dialogs.hpp>
#include<vcl.h>
#ifndef ProductListH
#define ProductListH
#include"Product.h"
//---------------------------------------------------------------------------
class ProductList
{
private:

public:
void search();
void Print(TMemo *);
Product *Products;
Product *Start;
Product *next;
ProductList();
~ProductList();
};
#endif

//---------------------------------------------------------------------------

#include <stdio.h>
#include<fstream.h>
//---------------------------------------------------------------------------

#pragma resource "*.dfm"
#pragma package(smart_init)
#include<vcl.h>
#pragma hdrstop
#include "ProductList.h"
using namespace std;
//---------------------------------------------------------------------------
ProductList::ProductList(){
Start = new Product();
}
void ProductList::Print(TMemo *Memo1)
{

ifstream infile("food.txt");
Products = Start;
Start = NULL;
if(infile.is_open())
{
while(!infile.eof())
{
infile >> Products->getid();
infile >> Products->getname();
infile >> Products->getprice();
infile >> Products->getweight();
infile >> Products->getvatPrice();

Memo1->Lines->Add(Products->getid());
Memo1->Lines->Add(Products->getname());
Memo1->Lines->Add(Products->getprice());
Memo1->Lines->Add(Products->getweight());
Memo1->Lines->Add(Products->getvatPrice());

Products = Products->next;
Products = new Product();
Products->next = NULL;

}
}
}
ProductList::~ProductList(){
delete Start;
}

Thanks
Nov 16 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.