Probleme ein Beispiel aus dem Netz unter Dev-CPP zu kompilieren.
-
Hallo Leute,
bin als Java Programmiere relativ neu in C++ und habe das Problem, dass ich eine Beispielanwendung (ein Spielbeispiel vom Oreilly Buch: "AI for Game Developers") nicht kompilieren kann. Es gibt jede Menge Fehlermeldungen, die ich nicht genau interpretieren kann. Kann mir einer helfen?
Kann es vielleicht an irgendwelchen fehlenden Bibliotheken liegen oder das die Pfade in den Dateien zu den Bibliotheken falsch gesetzt sind?Die Datei mit den Beispielen kann man sich unter
http://examples.oreilly.com/ai/Examples.zip runterladen.
Dort hatte ich es mit der ersten Demo "AIDemo2-2" versucht.Wäre für jede Hilfe dankbar.
Danke und Gruß
Ortega
-
Hallo,
Wäre für jede Hilfe dankbar.
wäre für die Liste der Fehlermeldungen dankbar. Denn nur so können wir sagen, woran's bei dir liegt.
EDIT: Ich gehe jetzt einfach mal davon aus, dass es mal nicht am Dev-Cpp liegt^^
MfG
GPC
-
Stimmt
wobei in dem Verzeichnis gibt es drei .cpp Dateien:
1. winmain.cpp
2. main.cpp
3. RigidBody2D.cpp (einge rudimentäre Physik Engine)
Hier also die CompilerLog beim Compilierversuch der main.cpp :Compiler: Default compiler Führt g++.exe... aus g++.exe "C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp" -o "C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.exe" -I"C:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include" -I"C:\Dev-Cpp\include\c++\3.4.2\backward" -I"C:\Dev-Cpp\include\c++\3.4.2\mingw32" -I"C:\Dev-Cpp\include\c++\3.4.2" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib" In file included from C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\/main.h:4, from C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:1: C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\/winmain.h:31:7: warning: no newline at end of file In file included from C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\/main.h:5, from C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:1: C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\/mymath.h:715:7: warning: no newline at end of file In file included from C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\/main.h:6, from C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:1: C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\/RigidBody2D.h:64:7: warning: no newline at end of file In file included from C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:1: C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\/main.h:26:7: warning: no newline at end of file C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp: In function `void DrawCraft(RigidBody2D, COLORREF)': C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:183: warning: passing `float' for converting 1 of `void DrawLine(int, int, int, int, int, COLORREF)' C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:183: warning: passing `float' for converting 2 of `void DrawLine(int, int, int, int, int, COLORREF)' C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:183: warning: passing `float' for converting 3 of `void DrawLine(int, int, int, int, int, COLORREF)' C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:183: warning: passing `float' for converting 4 of `void DrawLine(int, int, int, int, int, COLORREF)' C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:184: warning: passing `float' for converting 1 of `void DrawLine(int, int, int, int, int, COLORREF)' C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:184: warning: passing `float' for converting 2 of `void DrawLine(int, int, int, int, int, COLORREF)' C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:184: warning: passing `float' for converting 3 of `void DrawLine(int, int, int, int, int, COLORREF)' C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:184: warning: passing `float' for converting 4 of `void DrawLine(int, int, int, int, int, COLORREF)' C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:185: warning: passing `float' for converting 1 of `void DrawLine(int, int, int, int, int, COLORREF)' C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:185: warning: passing `float' for converting 2 of `void DrawLine(int, int, int, int, int, COLORREF)' C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:185: warning: passing `float' for converting 3 of `void DrawLine(int, int, int, int, int, COLORREF)' C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:185: warning: passing `float' for converting 4 of `void DrawLine(int, int, int, int, int, COLORREF)' C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:186: warning: passing `float' for converting 1 of `void DrawLine(int, int, int, int, int, COLORREF)' C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:186: warning: passing `float' for converting 2 of `void DrawLine(int, int, int, int, int, COLORREF)' C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:186: warning: passing `float' for converting 3 of `void DrawLine(int, int, int, int, int, COLORREF)' C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:186: warning: passing `float' for converting 4 of `void DrawLine(int, int, int, int, int, COLORREF)' C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:187: warning: passing `float' for converting 1 of `void DrawLine(int, int, int, int, int, COLORREF)' C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:187: warning: passing `float' for converting 2 of `void DrawLine(int, int, int, int, int, COLORREF)' C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:187: warning: passing `float' for converting 3 of `void DrawLine(int, int, int, int, int, COLORREF)' C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:187: warning: passing `float' for converting 4 of `void DrawLine(int, int, int, int, int, COLORREF)' C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:195: warning: passing `float' for converting 1 of `void DrawLine(int, int, int, int, int, COLORREF)' C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:195: warning: passing `float' for converting 2 of `void DrawLine(int, int, int, int, int, COLORREF)' C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:195: warning: passing `float' for converting 3 of `void DrawLine(int, int, int, int, int, COLORREF)' C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:195: warning: passing `float' for converting 4 of `void DrawLine(int, int, int, int, int, COLORREF)' C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:205: warning: passing `float' for converting 1 of `void DrawLine(int, int, int, int, int, COLORREF)' C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:205: warning: passing `float' for converting 2 of `void DrawLine(int, int, int, int, int, COLORREF)' C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:205: warning: passing `float' for converting 3 of `void DrawLine(int, int, int, int, int, COLORREF)' C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:205: warning: passing `float' for converting 4 of `void DrawLine(int, int, int, int, int, COLORREF)' C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:214: warning: passing `float' for converting 1 of `void DrawLine(int, int, int, int, int, COLORREF)' C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:214: warning: passing `float' for converting 2 of `void DrawLine(int, int, int, int, int, COLORREF)' C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:214: warning: passing `float' for converting 3 of `void DrawLine(int, int, int, int, int, COLORREF)' C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:214: warning: passing `float' for converting 4 of `void DrawLine(int, int, int, int, int, COLORREF)' C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:223: warning: passing `float' for converting 1 of `void DrawLine(int, int, int, int, int, COLORREF)' C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:223: warning: passing `float' for converting 2 of `void DrawLine(int, int, int, int, int, COLORREF)' C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:223: warning: passing `float' for converting 3 of `void DrawLine(int, int, int, int, int, COLORREF)' C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:223: warning: passing `float' for converting 4 of `void DrawLine(int, int, int, int, int, COLORREF)' C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:232: warning: passing `float' for converting 1 of `void DrawLine(int, int, int, int, int, COLORREF)' C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:232: warning: passing `float' for converting 2 of `void DrawLine(int, int, int, int, int, COLORREF)' C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:232: warning: passing `float' for converting 3 of `void DrawLine(int, int, int, int, int, COLORREF)' C:\Dokumente und Einstellungen\janik\Desktop\Examples\AIDemo2-2\main.cpp:232: warning: passing `float' for converting 4 of `void DrawLine(int, int, int, int, int, COLORREF)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x248):main.cpp: undefined reference to `RigidBody2D::SetThrusters(bool, bool)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x254):main.cpp: undefined reference to `IsKeyDown(short)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x26c):main.cpp: undefined reference to `RigidBody2D::ModulateThrust(bool)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x278):main.cpp: undefined reference to `IsKeyDown(short)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x290):main.cpp: undefined reference to `RigidBody2D::ModulateThrust(bool)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x29c):main.cpp: undefined reference to `IsKeyDown(short)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x2bc):main.cpp: undefined reference to `RigidBody2D::SetThrusters(bool, bool)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x2c8):main.cpp: undefined reference to `IsKeyDown(short)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x2e8):main.cpp: undefined reference to `RigidBody2D::SetThrusters(bool, bool)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x316):main.cpp: undefined reference to `BasicChase' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x329):main.cpp: undefined reference to `BasicEvade' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x337):main.cpp: undefined reference to `InterceptChase' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x345):main.cpp: undefined reference to `PotentialChase' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x360):main.cpp: undefined reference to `RigidBody2D::UpdateBodyEuler(double)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x373):main.cpp: undefined reference to `RigidBody2D::UpdateBodyEuler(double)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x389):main.cpp: undefined reference to `ShowTrails' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x391):main.cpp: undefined reference to `ClearBackBuffer()' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x481):main.cpp: undefined reference to `DrawEllipse(tagRECT*, int, unsigned long)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x486):main.cpp: undefined reference to `CopyBackBufferToWindow()' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x6c8):main.cpp: undefined reference to `VRotate2D(float, Vector)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x803):main.cpp: undefined reference to `DrawLine(int, int, int, int, int, unsigned long)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x8ad):main.cpp: undefined reference to `DrawLine(int, int, int, int, int, unsigned long)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x957):main.cpp: undefined reference to `DrawLine(int, int, int, int, int, unsigned long)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0xa01):main.cpp: undefined reference to `DrawLine(int, int, int, int, int, unsigned long)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0xaab):main.cpp: undefined reference to `DrawLine(int, int, int, int, int, unsigned long)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0xab1):main.cpp: undefined reference to `ShowVectors' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0xb8e):main.cpp: undefined reference to `DrawLine(int, int, int, int, int, unsigned long)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0xbdb):main.cpp: undefined reference to `VRotate2D(float, Vector)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0xc4d):main.cpp: undefined reference to `VRotate2D(float, Vector)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0xd40):main.cpp: undefined reference to `DrawLine(int, int, int, int, int, unsigned long)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0xd91):main.cpp: undefined reference to `VRotate2D(float, Vector)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0xe03):main.cpp: undefined reference to `VRotate2D(float, Vector)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0xef6):main.cpp: undefined reference to `DrawLine(int, int, int, int, int, unsigned long)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0xf47):main.cpp: undefined reference to `VRotate2D(float, Vector)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0xfb9):main.cpp: undefined reference to `VRotate2D(float, Vector)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x10ac):main.cpp: undefined reference to `DrawLine(int, int, int, int, int, unsigned long)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x1103):main.cpp: undefined reference to `VRotate2D(float, Vector)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x1175):main.cpp: undefined reference to `VRotate2D(float, Vector)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x1268):main.cpp: undefined reference to `DrawLine(int, int, int, int, int, unsigned long)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x1305):main.cpp: undefined reference to `VRotate2D(float, Vector)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x138f):main.cpp: undefined reference to `RigidBody2D::SetThrusters(bool, bool)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x142b):main.cpp: undefined reference to `VRotate2D(float, Vector)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x148f):main.cpp: undefined reference to `RigidBody2D::SetThrusters(bool, bool)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x165a):main.cpp: undefined reference to `VRotate2D(float, Vector)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x1782):main.cpp: undefined reference to `VRotate2D(float, Vector)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x1a58):main.cpp: undefined reference to `RigidBody2D::SetThrusters(bool, bool)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x1b37):main.cpp: undefined reference to `VRotate2D(float, Vector)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x1b84):main.cpp: undefined reference to `RigidBody2D::SetThrusters(bool, bool)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x1dc4):main.cpp: undefined reference to `VRotate2D(float, Vector)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x1e39):main.cpp: undefined reference to `RigidBody2D::SetThrusters(bool, bool)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x1fa0):main.cpp: undefined reference to `VRotate2D(float, Vector)' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x23b3):main.cpp: undefined reference to `RigidBody2D::RigidBody2D()' C:\DOKUME~1\janik\LOKALE~1\Temp/ccQdbaaa.o(.text+0x23ce):main.cpp: undefined reference to `RigidBody2D::RigidBody2D()' C:\Dev-Cpp\lib/libmingw32.a(main.o)(.text+0x106):main.c: undefined reference to `WinMain@16' collect2: ld returned 1 exit status Ausführung beendet
-
Hallo
Du musst auf jeden Fall noch die benutze Bibliothek zum Projekt linken.
chrische
-
Hi,
danke.
Sorry, dass ich nicht ganz auf der Hoehe bin aber wie linke ich die Bibliotheken?
Sind das die Dateien mit der Endung *.h?
Ich habe versucht diese Dateien mal ins Bib Verzeichnis von Dev-cpp zu kopieren aber das brachte nix.UPDATE:
Ich habe jetzt einfach alle Dateien aus dem Verzeichnis ins Projekt importiert und es kommt nun nur noch die folgende Fehlermeldung:
Compiler: Default compiler Building Makefile: "C:\c\Example2_2_DEV\Makefile.win" Executing make... make.exe -f "C:\c\Example2_2_DEV\Makefile.win" all g++.exe main_bak.o ../AIDemo2-2/main.o ../AIDemo2-2/RigidBody2D.o ../AIDemo2-2/winmain.o Example2_2_private.res -o "Example2_2.exe" -L"C:/Dev-Cpp/lib" -mwindows ../AIDemo2-2/winmain.o(.text+0x0):winmain.cpp: multiple definition of `WinMain@16' main_bak.o(.text+0x0):main_bak.cpp: first defined here collect2: ld returned 1 exit status make.exe: *** [Example2_2.exe] Error 1 Execution terminated
-
ortega schrieb:
Hi,
danke.
Sorry, dass ich nicht ganz auf der Hoehe bin aber wie linke ich die Bibliotheken?
Sind das die Dateien mit der Endung *.h?ne, .h (oder .hpp) Dateien sind Header. Bibliotheken haben z.B. eine Endung .dll (für dynamische). Okay, aber was chrische5 eigentlich meinte: Du sollst die Header (speziell den mit der Physik-Engine) zum Projekt hinzufügen.
Ich habe jetzt einfach alle Dateien aus dem Verzeichnis ins Projekt importiert und es kommt nun nur noch die folgende Fehlermeldung:
Okay, so weit so gut
Compiler: Default compiler Building Makefile: "C:\c\Example2_2_DEV\Makefile.win" Executing make... make.exe -f "C:\c\Example2_2_DEV\Makefile.win" all g++.exe main_bak.o ../AIDemo2-2/main.o ../AIDemo2-2/RigidBody2D.o ../AIDemo2-2/winmain.o Example2_2_private.res -o "Example2_2.exe" -L"C:/Dev-Cpp/lib" -mwindows ../AIDemo2-2/winmain.o(.text+0x0):winmain.cpp: multiple definition of `WinMain@16' main_bak.o(.text+0x0):main_bak.cpp: first defined here collect2: ld returned 1 exit status make.exe: *** [Example2_2.exe] Error 1 Execution terminated
Ja, du hast zwei main Methoden, eine muss raus.
MfG
GPC
-
Hallo,
super, jetzt klappt es!!! Ich dachte, der bezieht die main_bak.cpp nicht mit in den kompilierprozess ein.
Jedenfalls habe ich noch eine Frage:
Bei den Beispielen (siehe Link) kann ich die Dateien von "Chapter 2-4 Chasing" nicht kompilieren. Die Dateiendungen enden mit *.c, heisst es, dass das ein C Programm ist und kein C++ ??
Da fehlen wohl irgendwelche .h Dateien. Weiss einer, wo ich die herbekomme?
Wenn ich das Programm mit dem C++ Kompiler compilieren will, bekomme ich folgende Fehler:Compiler: Default compiler
Building Makefile: "C:\c\AIDemo2-4\Makefile.win"
Executing make clean
rm -f AICommon.o MacMain.o Toolbox.o AI2_4.exeg++.exe -c AICommon.c -o AICommon.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include" -fno-access-control
In file included from AICommon.c:2:
Toolbox.h:4:19: sound.h: No such file or directory
Toolbox.h:5:25: QDOffscreen.h: No such file or directory
Toolbox.h:6:19: Menus.h: No such file or directory
Toolbox.h:7:24: MacWindows.h: No such file or directoryToolbox.h:8:22: TextEdit.h: No such file or directory
Toolbox.h:9:21: Dialogs.h: No such file or directory
Toolbox.h:10:21: OSUtils.h: No such file or directory
Toolbox.h:11:23: ToolUtils.h: No such file or directory
Toolbox.h:12:21: SegLoad.h: No such file or directory
Toolbox.h:13:25: AppleEvents.h: No such file or directory
Toolbox.h:14:20: Movies.h: No such file or directory
Toolbox.h:15:21: Gestalt.h: No such file or directory
Toolbox.h:16:20: Events.h: No such file or directory
Toolbox.h:17:19: Traps.h: No such file or directory
Toolbox.h:18:19: Timer.h: No such file or directory
Toolbox.h:20:22: palettes.h: No such file or directory
Toolbox.h:21:22: Controls.h: No such file or directory
Toolbox.h:22:22: balloons.h: No such file or directory
Toolbox.h:23:22: Printing.h: No such file or directory
Toolbox.h:24:23: PictUtils.h: No such file or directory
Toolbox.h:25:21: FixMath.h: No such file or directory
Toolbox.h:26:26: StandardFile.h: No such file or directory
Toolbox.h:27:30: ImageCompression.h: No such file or directory
Toolbox.h:28:21: Folders.h: No such file or directory
Toolbox.h:29:30: NumberFormatting.h: No such file or directory
Toolbox.h:30:28: InternetConfig.h: No such file or directory
In file included from Toolbox.h:36,
from AICommon.c:2:
Remap.h:20:24: warning: no newline at end of file
In file included from Toolbox.h:37,
from AICommon.c:2:
Keys.h:105:22: warning: no newline at end of file
In file included from AICommon.c:2:
Toolbox.h:97: error: `ModalFilterUPP' does not name a typeToolbox.h:102: error:
Rect' was not declared in this scope Toolbox.h:102: error:
r' was not declared in this scopeToolbox.h:102: error: expected primary-expression before "int"
Toolbox.h:102: error: expected primary-expression before "int"
Toolbox.h:102: error: initializer expression list treated as compound expression
Toolbox.h:103: error: `Rect' has not been declaredToolbox.h:103: error:
Rect' has not been declared Toolbox.h:103: error:
Rect' has not been declared
Toolbox.h:103: error: ISO C++ forbids declaration ofsrcRect' with no type Toolbox.h:103: error: ISO C++ forbids declaration of
maskRect' with no type
Toolbox.h:103: error: ISO C++ forbids declaration of `dstRect' with no typeToolbox.h:104: error:
Rect' has not been declared Toolbox.h:104: error:
Rect' has not been declared
Toolbox.h:104: error:Boolean' has not been declared Toolbox.h:104: error: ISO C++ forbids declaration of
srcRect' with no type
Toolbox.h:104: error: ISO C++ forbids declaration ofdstRect' with no type Toolbox.h:104: error: ISO C++ forbids declaration of
Transparent' with no type
Toolbox.h:105: error: `Boolean' does not name a typeToolbox.h:107: error:
WindowPtr' was not declared in this scope Toolbox.h:109: error:
WindowPtr' was not declared in this scopeToolbox.h:110: error:
Rect' has not been declared Toolbox.h:110: error: ISO C++ forbids declaration of
r' with no typeIn file included from AICommon.c:2:
Toolbox.h:114:20: warning: no newline at end of file
In file included from AICommon.c:3:AICommon.h:84: error: `Boolean' does not name a type
In file included from AICommon.c:3:
AICommon.h:96:7: warning: no newline at end of file
AICommon.c:14: error:Rect' does not name a type AICommon.c:15: error:
Rect' does not name a typeAICommon.c:16: error:
Rect' does not name a type AICommon.c:17: error:
Rect' does not name a type
AICommon.c:19: error:Rect' does not name a type AICommon.c:20: error:
Rect' does not name a type
AICommon.c:21: error:Rect' does not name a type AICommon.c:22: error:
Boolean' does not name a type
AICommon.c:24: error: `Boolean' does not name a typeAICommon.c: In member function
int ai_Entity::DistanceFrom(int)': AICommon.c:140: warning: converting to \
int' from `double'AICommon.c: In member function
void ai_Entity::ShowPath()': AICommon.c:367: error:
terrain' undeclared (first use this function)
AICommon.c:367: error: (Each undeclared identifier is reported only once for each function it appears in.)
AICommon.c: In constructorai\_World::ai\_World()': AICommon.c:377: error:
Rect' undeclared (first use this function)
AICommon.c:377: error: expected;' before "r" AICommon.c:383: error:
showPath' undeclared (first use this function)
AICommon.c:386: error:screenRect' undeclared (first use this function) AICommon.c:386: error:
SetRect' undeclared (first use this function)
AICommon.c:387: error:tb_CreateBitmap' cannot be used as a function AICommon.c:390: error:
r' undeclared (first use this function)
AICommon.c:390: error:tb_CreateBitmap' cannot be used as a function AICommon.c:393: error:
tb_CreateBitmap' cannot be used as a function
AICommon.c:394: error:tb_CreateBitmap' cannot be used as a function AICommon.c:396: error:
unitRect' undeclared (first use this function)
AICommon.c:397: error: `humanRect' undeclared (first use this function)AICommon.c:398: error:
trollRect' undeclared (first use this function) AICommon.c:399: error:
treeRect' undeclared (first use this function)
AICommon.c:401: error:terrainRect' undeclared (first use this function) AICommon.c:409: error:
destRect' undeclared (first use this function)
AICommon.c:410: error:terrainBackup' undeclared (first use this function) AICommon.c:410: error:
terrain' undeclared (first use this function)AICommon.c: In member function `void ai_World::UpdateWorld()':
AICommon.c:442: error:
terrain' undeclared (first use this function) AICommon.c:442: error:
terrainBackup' undeclared (first use this function)
AICommon.c:444: error: `showPath' undeclared (first use this function)AICommon.c:477: error: `TickCount' undeclared (first use this function)
AICommon.c: In member function
void ai_World::KeyDown(int)': AICommon.c:528: error:
TickCount' undeclared (first use this function)AICommon.c: In member function
void ai_World::Redraw()': AICommon.c:574: error:
Rect' undeclared (first use this function)
AICommon.c:574: error: expected;' before "objectDest" AICommon.c:579: error:
terrainRect' undeclared (first use this function)
AICommon.c:579: error:terrain' undeclared (first use this function) AICommon.c:579: error:
destRect' undeclared (first use this function)
AICommon.c:586: error:objectDest' undeclared (first use this function) AICommon.c:586: error:
unitRect' undeclared (first use this function)
AICommon.c:587: error:OffsetRect' undeclared (first use this function) AICommon.c:588: error:
humanRect' undeclared (first use this function)
AICommon.c:594: error: `trollRect' undeclared (first use this function)AICommon.c:600: error:
treeRect' undeclared (first use this function) AICommon.c:605: error:
screenRect' undeclared (first use this function)AICommon.c:607:2: warning: no newline at end of file
make.exe: *** [AICommon.o] Error 1
Execution terminated
Vielleicht kann jemand mal versuchen dieses Beispiel zu kompilieren...
-
Das sind irgendwelche selbstgeschriebenen Header, die gehören jedenfalls weder zum Standard noch zu irgendwas, was man sonst so nem Compiler beilegt. Da kann ich dir leider nicht helfen. Sorry.
Die Dateiendungen enden mit *.c, heisst es, dass das ein C Programm ist und kein C++ ??
Ummm, ja, also es ist so, dass der Compiler anhand der Dateiendung .c annimmt, dass es auch ein C Programm ist und deshalb bei .cpp oder .cc von einem C++ Programm ausgeht und eben den entsprechenden Compiler (gcc für C, g++ für C++) aufruft.
MfG
GPC