Can some one please help me with this code, and explain why it doesn't work?
(I'm using c++ builder 6 by Borland)
Code:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Tank1.h"
#include "Unit1.h"
#include "Global_Var.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
int x;
int y ;
Tank1 *Tank = new Tank1;
TImage *Sprite_Tank1 = new TImage(Owner);
//extern TImage *Sprite_Tank1 ;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void WTF(int x, int y,Tank1 *Tank, TImage *Sprite_Tank1)
{
int temp;
temp=0;
temp = temp + 2;
Tank->body = blue;
Sprite_Tank1->Picture->LoadFromFile("Cheshire.ico");
Form1->Canvas->Draw((x),(y),Sprite_Tank1->Picture->Graphic );
}
void __fastcall TForm1::Button1Click(TObject *Sender)
{
int i;
y=200;
x=100 ;
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
Timer1->Enabled = true;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
static int y ;
static int x;
y=y+10;
x=x+10;
WTF(x,y,Tank,Sprite_Tank1);
Form1->Repaint();
}
//---------------------------------------------------------------------------
this is in my main .cpp file
this is in my Tank1.h file
Code:
#include <vcl.h>
enum color {blue, black, green, camo};
class Tank1
{
public:
TGraphic *Sprite_Tank1;
color body;
int x1;
int y1;
// Move_left();
// Move_right();
// Shoot();
};
and this is my Global_Var.h file
Code:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
extern int x;
extern int y ;
extern Tank1 *Tank = new Tank1;
//extern TImage *Sprite_Tank1 = new TImage(Owner);
I get this error when I compile:
[C++ Error] Unit1.cpp(17): E2451 Undefined symbol 'Owner'
thanks for the help
DW