Autor Beitrag
Zlatan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 175



BeitragVerfasst: Di 12.04.11 14:17 
Ich habe auf Form1 g als integer deklariert. Diese wird weiterhin benötigt.
Nun habe ich weitere formen 2,3,4 und 5.
Nur bei der Fünften gibt es Probleme (undefinierter Bezeichner g)
Hier mein Quelltext, bitte korrigieren, ok?
dankeschön Zlatan

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
begin
 if g<300 then begin showmessage('Zu wenig Geld'); end       ///in dieser zeile nur
else if g >= 300 then begin Form1.Waffe.Caption:='G36C';
Form2.Waffe2.Caption:='G36C';
Form3.Waffe3.Caption:='G36C';
Form5.Waffe4.Caption:='G36C';
p:=35;
g:= g -300;
Form1.geld.Caption:= inttostr(G) +' $';
Form2.geld2.Caption:= inttostr(G) +' $';
Form3.geld3.Caption:= inttostr(G) +' $';
Form5.geld4.Caption:= inttostr(G) +' $';
Image2.Hide; end
end;



Moderiert von user profile iconNarses: Topic aus Sonstiges (Delphi) verschoben am Di 12.04.2011 um 15:43
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8553
Erhaltene Danke: 479

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Di 12.04.11 14:27 
Füge Unit1 bei Form5 in die uses-Liste mit ein. Wenn es dann einen Kreuzbezug gibt (sehr wahrscheinlich ist das so), dann musst du unter implementation eine eine neue uses-Liste einfügen und Unit1 dort eintragen

_________________
We are, we were and will not be.

Für diesen Beitrag haben gedankt: Zlatan
Zlatan Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 175



BeitragVerfasst: Di 12.04.11 14:29 
So?
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, jpeg, ExtCtrls, StdCtrls;
......
var
  Form5: TForm5;

implementation

uses Unit3, Unit2, Unit1;
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8553
Erhaltene Danke: 479

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Di 12.04.11 14:30 
Ja, das sollte so funktionieren. :)

_________________
We are, we were and will not be.
Zlatan Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 175



BeitragVerfasst: Di 12.04.11 14:32 
leider nicht, das ist nämlich der text , den ich schon die ganze zeit hatte :(
noch ne andere idee???
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8553
Erhaltene Danke: 479

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Di 12.04.11 14:33 
Ist g denn wirklich eine globale Variable, oder eine Variable (oder Property) der Klasse TForm1?

_________________
We are, we were and will not be.
Zlatan Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 175



BeitragVerfasst: Di 12.04.11 14:34 
ich hab ne idee :think:
kann es sein das der fehler daran liegt, das in unit1 unter uses nicht unit5 ist?
und ja die ist global

---Moderiert von user profile iconNarses: Beiträge zusammengefasst---

ne doch nicht :autsch:
Vielleicht ein Speicherfehler?
Aber warum funktioniert das dann bei allen anderen units
Ich zeig einfach mal meine deklaration in unit1
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
var
  Form1: TForm1;
  p : integer;
  z : integer;
  g : integer;

implementation

uses Unit3, Unit2, Unit4, Unit5;

{$R *.dfm}



In Unit2 steht noch Could not compile used unit5.pas
Was hat das zu bedeuten?

MIr fällt gerade auf, dass es in meinem Ordner keine datei unit5.dcu gibt
schlimm???
Zlatan Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 175



BeitragVerfasst: Di 12.04.11 14:54 
ok, der fehler ist weg(leerzeichen?)
aber da steht : could not create output file

Sollte ich dafür ein neues thema machen?