Herzlich Willkommen, lieber Gast!
  Sie befinden sich hier:

  Forum » C / C++ (ANSI-Standard) » Probleme ein Beispiel aus dem Netz unter Dev-CPP zu kompilieren

Forum | Hilfe | Team | Links | Impressum | > Suche < | Mitglieder | Registrieren | Einloggen
  Quicklinks: MSDN-Online || STL || clib Reference Grundlagen || Literatur || E-Books || Zubehör || > F.A.Q. < || Downloads   

Autor Thread - Seiten: > 1 <
000
10.07.2006, 15:42 Uhr
ortega



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

P.S. Suche ergab keine passenden Antworten



Code:

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:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0x248):main.cpp: undefined reference to `RigidBody2D::SetThrusters(bool, bool)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0x254):main.cpp: undefined reference to `IsKeyDown(short)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0x26c):main.cpp: undefined reference to `RigidBody2D::ModulateThrust(bool)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0x278):main.cpp: undefined reference to `IsKeyDown(short)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0x290):main.cpp: undefined reference to `RigidBody2D::ModulateThrust(bool)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0x29c):main.cpp: undefined reference to `IsKeyDown(short)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0x2bc):main.cpp: undefined reference to `RigidBody2D::SetThrusters(bool, bool)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0x2c8):main.cpp: undefined reference to `IsKeyDown(short)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0x2e8):main.cpp: undefined reference to `RigidBody2D::SetThrusters(bool, bool)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0x316):main.cpp: undefined reference to `BasicChase'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0x329):main.cpp: undefined reference to `BasicEvade'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0x337):main.cpp: undefined reference to `InterceptChase'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0x345):main.cpp: undefined reference to `PotentialChase'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0x360):main.cpp: undefined reference to `RigidBody2D::UpdateBodyEuler(double)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0x373):main.cpp: undefined reference to `RigidBody2D::UpdateBodyEuler(double)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0x389):main.cpp: undefined reference to `ShowTrails'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0x391):main.cpp: undefined reference to `ClearBackBuffer()'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0x481):main.cpp: undefined reference to `DrawEllipse(tagRECT*, int, unsigned long)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0x486):main.cpp: undefined reference to `CopyBackBufferToWindow()'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0x6c8):main.cpp: undefined reference to `VRotate2D(float, Vector)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0x803):main.cpp: undefined reference to `DrawLine(int, int, int, int, int, unsigned long)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0x8ad):main.cpp: undefined reference to `DrawLine(int, int, int, int, int, unsigned long)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0x957):main.cpp: undefined reference to `DrawLine(int, int, int, int, int, unsigned long)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0xa01):main.cpp: undefined reference to `DrawLine(int, int, int, int, int, unsigned long)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0xaab):main.cpp: undefined reference to `DrawLine(int, int, int, int, int, unsigned long)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0xab1):main.cpp: undefined reference to `ShowVectors'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0xb8e):main.cpp: undefined reference to `DrawLine(int, int, int, int, int, unsigned long)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0xbdb):main.cpp: undefined reference to `VRotate2D(float, Vector)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0xc4d):main.cpp: undefined reference to `VRotate2D(float, Vector)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0xd40):main.cpp: undefined reference to `DrawLine(int, int, int, int, int, unsigned long)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0xd91):main.cpp: undefined reference to `VRotate2D(float, Vector)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0xe03):main.cpp: undefined reference to `VRotate2D(float, Vector)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0xef6):main.cpp: undefined reference to `DrawLine(int, int, int, int, int, unsigned long)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0xf47):main.cpp: undefined reference to `VRotate2D(float, Vector)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0xfb9):main.cpp: undefined reference to `VRotate2D(float, Vector)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0x10ac):main.cpp: undefined reference to `DrawLine(int, int, int, int, int, unsigned long)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0x1103):main.cpp: undefined reference to `VRotate2D(float, Vector)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0x1175):main.cpp: undefined reference to `VRotate2D(float, Vector)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0x1268):main.cpp: undefined reference to `DrawLine(int, int, int, int, int, unsigned long)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0x1305):main.cpp: undefined reference to `VRotate2D(float, Vector)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0x138f):main.cpp: undefined reference to `RigidBody2D::SetThrusters(bool, bool)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0x142b):main.cpp: undefined reference to `VRotate2D(float, Vector)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0x148f):main.cpp: undefined reference to `RigidBody2D::SetThrusters(bool, bool)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0x165a):main.cpp: undefined reference to `VRotate2D(float, Vector)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0x1782):main.cpp: undefined reference to `VRotate2D(float, Vector)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0x1a58):main.cpp: undefined reference to `RigidBody2D::SetThrusters(bool, bool)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0x1b37):main.cpp: undefined reference to `VRotate2D(float, Vector)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0x1b84):main.cpp: undefined reference to `RigidBody2D::SetThrusters(bool, bool)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0x1dc4):main.cpp: undefined reference to `VRotate2D(float, Vector)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0x1e39):main.cpp: undefined reference to `RigidBody2D::SetThrusters(bool, bool)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0x1fa0):main.cpp: undefined reference to `VRotate2D(float, Vector)'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.o(.text+0x23b3):main.cpp: undefined reference to `RigidBody2D::RigidBody2D()'
C:\DOKUME~1\janik\LOKALE~1\Temp/cca4aaaa.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




Dieser Post wurde am 10.07.2006 um 16:11 Uhr von ortega editiert.
 
Profil || Private Message || Suche Download || Zitatantwort || Editieren || Löschen || IP
001
10.07.2006, 16:42 Uhr
Th



Du mußt die Datei "RigidBody2D.cpp" (und evtl. noch weitere) noch zum Projekt hinzufügen und kompilieren lassen.

Die letzte Fehlermeldung sagt aus, daß es irgendwie Probleme mit WinMain gibt.
Wenn das Projekt eine Win32-Anwendung ist, dann darfst du es nicht als Konsolenanwendung erstellen und umgekehrt.
 
Profil || Private Message || Suche Download || Zitatantwort || Editieren || Löschen || IP
002
10.07.2006, 17:08 Uhr
ortega



ok, danke.
Habe jetzt alle Dateien ins Projekt eingefuegt und bekomme nun die folgende Fehlermeldung:


Code:
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


 
Profil || Private Message || Suche Download || Zitatantwort || Editieren || Löschen || IP
003
10.07.2006, 18:11 Uhr
xXx
Devil


Du hast aus einem mir unerklärlichen Grund 2x eine WinMain angelegt
 
Profil || Private Message || Suche Download || Zitatantwort || Editieren || Löschen || IP
004
10.07.2006, 18:43 Uhr
ortega



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:


Zitat:


Compiler: Default compiler
Building Makefile: "Cc\AIDemo2-4\Makefile.win"
Executing make clean
rm -f AICommon.o MacMain.o Toolbox.o AI2_4.exe

g++.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 directory

Toolbox.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 type

Toolbox.h:102: error: `Rect' was not declared in this scope
Toolbox.h:102: error: `r' was not declared in this scope

Toolbox.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 declared

Toolbox.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 of `srcRect' 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 type

Toolbox.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 of `dstRect' 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 type

Toolbox.h:107: error: `WindowPtr' was not declared in this scope
Toolbox.h:109: error: `WindowPtr' was not declared in this scope

Toolbox.h:110: error: `Rect' has not been declared
Toolbox.h:110: error: ISO C++ forbids declaration of `r' with no type

In 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 type

AICommon.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 type

AICommon.c: In member function `int ai_Entity:istanceFrom(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 constructor `ai_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...
 
Profil || Private Message || Suche Download || Zitatantwort || Editieren || Löschen || IP
Seiten: > 1 <     [ C / C++ (ANSI-Standard) ]  


ThWBoard 2.73 FloSoft-Edition
© by Paul Baecher & Felix Gonschorek (www.thwboard.de)

Anpassungen des Forums
© by Flo-Soft (www.flo-soft.de)

Sie sind Besucher: