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
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 |
class InputGuard{ public: inline ~InputGuard(){ if(! Input::_instance){ delete Input::_instance; Input::_instance = NULL; } } }; friend class InputGuard; |
Zitat von »"kiba"«
C-/C++-Quelltext
1 2 3 4 5 6 7 8 9 10 //defnif blabla //define blabla //include gl,glfw,il #if defined(CORE_EXPORTS) #define DLL __declspec(dllexport) #else #define DLL __declspec(dllimport) #endif //....
Graphics.h
C-/C++-Quelltext
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 //defnif blabla //define blabla #include "basic.h" class DLL Graphics{ private: //.... static Graphic* _instance; class GraphicGuard{ private: inline ~GraphicGuard(){ if(! Graphic::_instance){ delete Graphic::_instance; Graphic::_instance = NULL; } } }; friend class GraphicGuard; public: //.... inline static Graphic* getInstanz(){ static GraphicGuard g; if (!Graphic::_instance) Graphic::_instance = new Graphic; return Graphic::_instance; } };
Input.h
C-/C++-Quelltext
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 //defnif blabla //define blabla #include "basic.h" class DLL Input{ private: //.... static Input* _instance; class InputGuard{ private: inline ~InputGuard(){ if(! Input::_instance){ delete Input::_instance; Input::_instance = NULL; } } }; friend class InputGuard; public: //.... inline static Input* getInstanz(){ static InputGuard g; if (!Input::_instance) Input::_instance = new Input; return Input::_instance; } };
C-/C++-Quelltext |
|
1 2 3 4 5 |
if(! Input::_instance) // Löschen, wenn NULL? { delete Input::_instance; Input::_instance = NULL; } |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 |
class InputGuard{ public: inline ~InputGuard(){ if(Input::_instance){ delete Input::_instance; Input::_instance = NULL; } } }; friend class InputGuard; |
Quellcode |
|
1 2 3 4 |
obj\Debug\main.o||In function `_ZN3F2C5Input10getInstanzEv':| \..\Graphics\Graphics.h:(.text$_ZN3F2C5Input10getInstanzEv[Input::getInstanz()]+0x80)||undefined reference to `__imp___ZN3F2C5InputC1Ev'| \..\Graphics\Graphics.h:(.text$_ZN3F2C5Input10InputGuardD1EvInput::InputGuard::~InputGuard()]+0x27)||undefined reference to `__imp___ZN3F2C5InputD1Ev'| ||=== Build finished: 2 errors, 0 warnings ===| |
Zitat von »"kiba"«
hi, Hab wieder mal ein Problem
und ich weiß das das ein "Anfänger" Problem ist.
Und ja ich hab alles eingebunden was ich brauche.
(zu mindest sieht es so aus)
Ach ja ich benutz Code::Blocks
...........
Linker:
-libCore.a <-- hier
-devil
-ilu
-ilut
-glfw
-opengl32
-glu32
-gdi32
Quellcode |
|
1 2 3 4 5 6 7 |
mingw32-g++.exe -o bin\Debug\main.exe obj\Debug\main.o obj\Debug bin\Debug\libCore.a -lopengl32 -lglu32 -lgdi32 -lglfw -ldevil -lilu -lilut -mwindows obj\Debug\main.o: In function `_ZN3F2C5Input10getInstanzEv': main/../Graphics/Graphics.h:(.text$_ZN3F2C5Input10getInstanzEv[Input::getInstanz()]+0x80): undefined reference to `__imp___ZN3F2C5InputC1Ev' main/../Graphics/Graphics.h:(.text$_ZN3F2C5Input10InputGuardD1Ev[Input::InputGuard::~InputGuard()]+0x27): undefined reference to `__imp___ZN3F2C5InputD1Ev' collect2: ld returned 1 exit status Process terminated with status 1 (0 minutes, 0 seconds) 2 errors, 0 warnings |
Werbeanzeige