Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!
Werbeanzeige
Quellcode |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
// Kapitel 2 // Beispielprogramm 01 // =================== // Erstellen des Fensters und Aufrufen der Nachrichtenschleife. // Die dafür nötigen Funktionen sind in der Datei InitWindow.cpp // gespeichert. #include <Windows.h> #include <TriBase.h> #include "InitWindow.h" #include "Resource.h" // ****************************************************************** // Render-Funktion tbResult Render(float fNumSecsPassed) { return TB_OK; } // ****************************************************************** // Move-Funktion tbResult Move(float fNumSecsPassed) { return TB_OK; } // ****************************************************************** // Windows-Hauptfunktion int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, char* pcCmdLine, int iShowCmd) { // TriBase-Engine initialisieren tbInit(); // Fenster initialisieren InitWindow(640, 480, "Beispielprogramm Nr. 2: Fenster", LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1))); // Nachrichtenschleife tbDoMessageLoop(Render, Move); // Fenster herunterfahren ExitWindow(); // Engine herunterfahren tbExit(); return 0; } // ****************************************************************** |
Zitat
Project : Console application
Compiler : Microsoft Visual C++ Toolkit 2003 (called directly)
Directory : C:\cpp\tb1\
--------------------------------------------------------------------------------
Switching to target: default
main.cpp
Linking executable: C:\cpp\tb1\tribase_templeate.exe
main.obj : error LNK2019: unresolved external symbol "enum tbResult __cdecl ExitWindow(void)" (?ExitWindow@@YA?AW4tbResult@@XZ) referenced in function _WinMain@16
main.obj : error LNK2019: unresolved external symbol "enum tbResult __cdecl InitWindow(int,int,char *,struct HICON__ *)" (?InitWindow@@YA?AW4tbResult@@HHPADPAUHICON__@@@Z) referenced in function _WinMain@16
C:\\cpp\\tb1\\tribase_templeate.exe : fatal error LNK1120: 2 unresolved externals
Process terminated with status 1 (0 minutes, 1 seconds)
3 errors, 0 warnings
Anonymous
unregistriert
C-/C++-Quelltext |
|
1 |
#include "InitWindow.h"
|
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
#include <windows.h> #include <tribase.h> #include "InitWindow.cpp" #include "Direct3DEnum.cpp" #include "InitDirect3D.cpp" int WINAPI WinMain(HINSTANCE hThisInstance, HINSTANCE hPrevInstance, char* pcCmdLpne, int iShowCmd) { tbInit(); SDirect3DParameters Direct3DParameters; tbResult result = GetDirect3DParameters(&Direct3DParameters); tbExit(); return 0; } |
Zitat
Project : Console application
Compiler : Microsoft Visual C++ Toolkit 2003 (called directly)
Directory : C:\cpp\tb2\
--------------------------------------------------------------------------------
Calculating dependencies: main.cpp
Switching to target: default
main.cpp
c:\cpp\tb2\Direct3DEnum.h(1 : error C2011: 'SDirect3DParameters' : 'struct' type redefinition
c:\cpp\tb2\Direct3DEnum.h(1 : see declaration of 'SDirect3DParameters'
Process terminated with status 1 (0 minutes, 1 seconds)
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
#include <windows.h> #include <tribase.h> #include "InitWindow.cpp" #include "InitDirect3D.cpp" int WINAPI WinMain(HINSTANCE hThisInstance, HINSTANCE hPrevInstance, char* pcCmdLpne, int iShowCmd) { tbInit(); SDirect3DParameters Direct3DParameters; tbResult result = GetDirect3DParameters(&Direct3DParameters); tbExit(); return 0; } |
Administrator
Zitat von »"David Scherfgen"«
Man bindet mit #include keine CPP-Dateien ein!
Die fügt man wie oben beschrieben zum Projekt hinzu.
Quellcode |
|
1 2 3 4 5 |
Calculating dependencies: main.cpp Switching to target: default cl : Command line warning D4026 : options apply to entire command line cl : Command line error D2036 : '/Fo.objs\\main.obj' not allowed with multiple source files Process terminated with status 1 (0 minutes, 4 seconds) |
Werbeanzeige