Solved

THOSE ERROR MESSAGE ABOUT?

Posted on 2000-03-19
3
314 Views
Last Modified: 2006-11-17
I JUST USE THE C++ BUILDER 4.0.
MY SOURCE IS:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TChart::TDBChart *dbc=new TDBChart();

dbc->Assign(DBChart1->Picture->Bitmap);

// TJPEGImage ¤º©wªºÀ£ÁY²v¬O90%
dbc->CompressionQuality=(short)Edit1->Text.ToInt();

dbc->SaveToBitmapFile("Test.bmp");

//±N¦sªºJPG¹ÏŪ¨ìImage2
// JPG->LoadFromFile("test.jpg");

// Image2->Picture->Bitmap->Assign(JPG);

delete dbc;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
if (CheckBox1->Checked)
   DeleteFile("Test.bmp");
}

THE ERROR MESSAGE IS:
[C++ Error] TEST.cpp(18): E2451 Undefined symbol 'TDBChart'.
[C++ Error] TEST.cpp(18): E2451 Undefined symbol 'dbc'.
[C++ Error] TEST.cpp(18): E2285 Could not find a match for 'TDBChart::TDBChart()'.
[C++ Error] TEST.cpp(20): E2316 'Picture' is not a member of 'TDBChart'.
[C++ Error] TEST.cpp(23): E2451 Undefined symbol 'Edit1'.
[C++ Error] TEST.cpp(32): E2158 Operand of 'delete' must be non-const pointer.
THOSE ERROR ABOUT WHAT?
THANK YOU!

0
Comment
Question by:erichuang
  • 2
3 Comments
 
LVL 31

Expert Comment

by:Zoppo
ID: 2635408
Hi erichuang,

I found at least one failure:

If TDBChart is declared in namespace of TChart, then
TChart::TDBChart *dbc=new TDBChart();
should be:
TChart::TDBChart *dbc=new TChart::TDBChart();

this should solve the first three and the last error.

the other errors seem to be declaration errors.
Unfortunately I'm not experienced with C++ builder, so I don't know the TDBChart class at all...

ZOPPO
0
 

Accepted Solution

by:
amador earned 80 total points
ID: 2639808
1 - the compilator cant find the obj TDBChat
2 - Consequence of 1
3 - He cant find the constructor TDBChart in obj TDBChart, if TDBChart is derived for TChart, put TChart:: before.
4 - He cant finda the function Picture in TDBChart, see 3
5 - Verify if Edit1 is declared, or if it is the name of the object really.
6 - Consequence of 1.

TChart::TDBChart *dbc= (TDBChart *) new TChart::TDBChart();

Test pointer before: if (dbc == NULL) return;

0
 
LVL 31

Expert Comment

by:Zoppo
ID: 2639894
Hi amador,

some comments:

>if TDBChart is derived for TChart, put TChart:: before.
derived??? I would say TDBChart is declared in namespace TChart, i.e. a 'subclass' of TChart...

>He cant finda the function Picture in TDBChart
From the code I would say 'object Picture' instead of 'function Picture'

>TChart::TDBChart *dbc= (TDBChart *) new TChart::TDBChart();
why use that extra cast (which will not work until you cast to (TCart::TDBChart*)new... ), it's not needed

ZOPPO
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now