Solved

THOSE ERROR MESSAGE ABOUT?

Posted on 2000-03-19
3
318 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
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 tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

756 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